Rev 4904: Move the hooks code over as well. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-read-reconnect-819604

John Arbash Meinel john at arbash-meinel.com
Sat Oct 8 09:45:36 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-read-reconnect-819604

------------------------------------------------------------
revno: 4904
revision-id: john at arbash-meinel.com-20111008094505-4s29efjowmf0abmi
parent: john at arbash-meinel.com-20111008094314-yh16binq9pf9fdu3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-client-read-reconnect-819604
timestamp: Sat 2011-10-08 11:45:05 +0200
message:
  Move the hooks code over as well.
  
  Basically, anything that needed all of these arguments should just be
  moved into the state class.
-------------- next part --------------
=== modified file 'bzrlib/smart/client.py'
--- a/bzrlib/smart/client.py	2011-10-08 09:43:14 +0000
+++ b/bzrlib/smart/client.py	2011-10-08 09:45:05 +0000
@@ -40,13 +40,6 @@
     def __repr__(self):
         return '%s(%r)' % (self.__class__.__name__, self._medium)
 
-    def _run_call_hooks(self, method, args, body, readv_body):
-        if not _SmartClient.hooks['call']:
-            return
-        params = CallHookParams(method, args, body, readv_body, self._medium)
-        for hook in _SmartClient.hooks['call']:
-            hook(params)
-
     def _call_and_read_response(self, method, args, body=None, readv_body=None,
             body_stream=None, expect_response_body=True):
         request = _SmartClientRequest(self, method, args, body=body,
@@ -132,13 +125,21 @@
         self.expect_response_body = expect_response_body
 
     def call_and_read_response(self):
-        self.client._run_call_hooks(self.method, self.args, self.body,
-                                    self.readv_body)
+        self._run_call_hooks()
         if self.client._medium._protocol_version is None:
             return self._call_determining_protocol_version()
         else:
             return self._call()
 
+    def _run_call_hooks(self):
+        if not _SmartClient.hooks['call']:
+            return
+        params = CallHookParams(self.method, self.args, self.body,
+                                self.readv_body, self.client._medium)
+        for hook in _SmartClient.hooks['call']:
+            hook(params)
+
+
     def _call(self):
         response_handler = self._send(
             self.client._medium._protocol_version)



More information about the bazaar-commits mailing list