~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/client.py

  • Committer: Robert Collins
  • Date: 2007-07-25 00:52:21 UTC
  • mfrom: (2650 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2651.
  • Revision ID: robertc@robertcollins.net-20070725005221-0ysm6il5mqnme3wz
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
class _SmartClient(object):
24
24
 
25
 
    def __init__(self, medium):
26
 
        self._medium = medium
 
25
    def __init__(self, shared_medium):
 
26
        self._shared_medium = shared_medium
 
27
 
 
28
    def get_smart_medium(self):
 
29
        return self._shared_medium.connection
27
30
 
28
31
    def call(self, method, *args):
29
32
        """Call a method on the remote server."""
39
42
            result, smart_protocol = smart_client.call_expecting_body(...)
40
43
            body = smart_protocol.read_body_bytes()
41
44
        """
42
 
        request = self._medium.get_request()
 
45
        request = self.get_smart_medium().get_request()
43
46
        smart_protocol = protocol.SmartClientRequestProtocolOne(request)
44
47
        smart_protocol.call(method, *args)
45
48
        return smart_protocol.read_response_tuple(expect_body=True), smart_protocol
53
56
                raise TypeError('args must be byte strings, not %r' % (args,))
54
57
        if type(body) is not str:
55
58
            raise TypeError('body must be byte string, not %r' % (body,))
56
 
        request = self._medium.get_request()
 
59
        request = self.get_smart_medium().get_request()
57
60
        smart_protocol = protocol.SmartClientRequestProtocolOne(request)
58
61
        smart_protocol.call_with_body_bytes((method, ) + args, body)
59
62
        return smart_protocol.read_response_tuple()