~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.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:
235
235
            `bzr://127.0.0.1:nnnn/`.  Default value is `extra`, so that tests
236
236
            by default will fail unless they do the necessary path translation.
237
237
        """
238
 
        assert client_path_extra.startswith('/')
 
238
        if not client_path_extra.startswith('/'):
 
239
            raise ValueError(client_path_extra)
239
240
        from bzrlib.transport.chroot import ChrootServer
240
241
        if backing_transport_server is None:
241
242
            from bzrlib.transport.local import LocalURLServer
254
255
 
255
256
    def get_url(self):
256
257
        url = super(SmartTCPServer_for_testing, self).get_url()
257
 
        assert url.endswith('/')
258
258
        return url[:-1] + self.client_path_extra
259
259
 
260
260
    def get_bogus_url(self):
269
269
        """Get a backing transport from a server we are decorating."""
270
270
        url = 'readonly+' + backing_transport_server.get_url()
271
271
        return transport.get_transport(url)
272