~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/chroot.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        self.backing_transport = backing_transport
46
46
 
47
47
    def _factory(self, url):
48
 
        assert url.startswith(self.scheme)
49
48
        return ChrootTransport(self, url)
50
49
 
51
50
    def get_url(self):
79
78
 
80
79
    def _safe_relpath(self, relpath):
81
80
        safe_relpath = self._combine_paths(self.base_path, relpath)
82
 
        assert safe_relpath.startswith('/')
 
81
        if not safe_relpath.startswith('/'):
 
82
            raise ValueError(safe_relpath)
83
83
        return safe_relpath[1:]
84
84
 
85
85
    # Transport methods