zmqclient.py
changeset 8670 f02139297beb
parent 8572 e54b3bc39011
child 10235 684215aca046
--- a/zmqclient.py	Mon Jan 21 18:01:25 2013 +0100
+++ b/zmqclient.py	Tue Jan 22 18:16:20 2013 +0100
@@ -23,6 +23,7 @@
 from functools import partial
 import zmq
 
+from cubicweb.server.cwzmq import cwproto_to_zmqaddr
 
 # XXX hack to overpass old zmq limitation that force to have
 # only one context per python process
@@ -33,9 +34,9 @@
 
 class ZMQRepositoryClient(object):
     """
-    This class delegate the overall repository stuff to a remote source.
+    This class delegates the overall repository stuff to a remote source.
 
-    So calling a method of this repository will results on calling the
+    So calling a method of this repository will result on calling the
     corresponding method of the remote source repository.
 
     Any raised exception on the remote source is propagated locally.
@@ -44,8 +45,13 @@
     """
 
     def __init__(self, zmq_address):
+        """A zmq address provided here will be like
+        `zmqpickle-tcp://127.0.0.1:42000`.  W
+
+        We chop the prefix to get a real zmq address.
+        """
         self.socket = ctx.socket(zmq.REQ)
-        self.socket.connect(zmq_address)
+        self.socket.connect(cwproto_to_zmqaddr(zmq_address))
 
     def __zmqcall__(self, name, *args, **kwargs):
          self.socket.send_pyobj([name, args, kwargs])