merge with 3.16.x fixes
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 29 May 2013 16:44:16 +0200
changeset 8992 55a1567d92a0
parent 8989 8742f4bf029f (current diff)
parent 8991 5238f62a430a (diff)
child 8995 a90a98800578
merge with 3.16.x fixes
.hgtags
dbapi.py
entity.py
server/serverconfig.py
--- a/.hgtags	Thu May 23 17:32:56 2013 +0200
+++ b/.hgtags	Wed May 29 16:44:16 2013 +0200
@@ -294,3 +294,6 @@
 cc1a0aad580cf93d26959f97d8d6638e786c1082 cubicweb-version-3.17.0
 22be40c492e9034483bfec379ca11462ea97825b cubicweb-debian-version-3.17.0-1
 09a0c7ea6c3cb97bbbeed3795b3c3715ceb9566b cubicweb-debian-version-3.17.0-2
+041804bc48e91e440a5b573ceb0df5bf22863b80 cubicweb-version-3.16.4
+041804bc48e91e440a5b573ceb0df5bf22863b80 cubicweb-debian-version-3.16.4-1
+041804bc48e91e440a5b573ceb0df5bf22863b80 cubicweb-centos-version-3.16.4-1
--- a/dbapi.py	Thu May 23 17:32:56 2013 +0200
+++ b/dbapi.py	Wed May 29 16:44:16 2013 +0200
@@ -213,9 +213,13 @@
         elif cnxprops and cnxprops.cnxtype == 'inmemory':
             database = 'inmemory://' + database
         else:
-            database = 'pyro://%s/%s.%s' % (kwargs.pop('host', ''),
-                                            kwargs.pop('group', 'cubicweb'),
-                                            database)
+            host = kwargs.pop('host', None)
+            if host is None:
+                host = ''
+            group = kwargs.pop('group', None)
+            if group is None:
+                group = 'cubicweb'
+            database = 'pyro://%s/%s.%s' % (host, group, database)
     puri = urlparse(database)
     method = puri.scheme.lower()
     if method == 'inmemory':
--- a/doc/book/en/devrepo/repo/hooks.rst	Thu May 23 17:32:56 2013 +0200
+++ b/doc/book/en/devrepo/repo/hooks.rst	Wed May 29 16:44:16 2013 +0200
@@ -186,7 +186,7 @@
       def __call__(self):
           def callback(msg):
               self.info('received message: %s', ' '.join(msg))
-          self.repo.app_instances_bus.subscribe('hello', callback)
+          self.repo.app_instances_bus.add_subscription('hello', callback)
 
 .. sourcecode:: python
 
@@ -195,9 +195,9 @@
       self._cw.repo.app_instances_bus.publish(['hello', 'world'])
 
 The `zmq-address-pub` configuration variable contains the address used
-by the instance for sending messages, e.g. `zmqpickle-tcp://*:1234`.  The
+by the instance for sending messages, e.g. `tcp://*:1234`.  The
 `zmq-address-sub` variable contains a comma-separated list of addresses
-to listen on, e.g. `zmqpickle-tcp://localhost:1234, zmqpickle-tcp://192.168.1.1:2345`.
+to listen on, e.g. `tcp://localhost:1234, tcp://192.168.1.1:2345`.
 
 
 Hooks writing tips
--- a/doc/book/en/devweb/js.rst	Thu May 23 17:32:56 2013 +0200
+++ b/doc/book/en/devweb/js.rst	Wed May 29 16:44:16 2013 +0200
@@ -191,7 +191,7 @@
 * it is called with two parameters: the current node, and a list
   containing the loaded (and post-processed node)
 
-* whenever is returns another function, this function is called in
+* whenever it returns another function, this function is called in
   turn with the same parameters as above
 
 This mechanism allows callback chaining.
@@ -209,7 +209,7 @@
     from cubicweb.web.views.ajaxcontroller import ajaxfunc
 
     @ajaxfunc(output_type='xhtml')
-    def js_frob_status(self, eid, frobname):
+    def frob_status(self, eid, frobname):
         entity = self._cw.entity_from_eid(eid)
         return entity.view('frob', name=frobname)
 
--- a/entity.py	Thu May 23 17:32:56 2013 +0200
+++ b/entity.py	Wed May 29 16:44:16 2013 +0200
@@ -1321,11 +1321,11 @@
 
     # deprecated stuff #########################################################
 
-    @deprecated('[3.16] use cw_set() instead')
+    @deprecated('[3.16] use cw_set() instead of set_attributes()')
     def set_attributes(self, **kwargs): # XXX cw_set_attributes
         self.cw_set(**kwargs)
 
-    @deprecated('[3.16] use cw_set() instead')
+    @deprecated('[3.16] use cw_set() instead of set_relations()')
     def set_relations(self, **kwargs): # XXX cw_set_relations
         """add relations to the given object. To set a relation where this entity
         is the object of the relation, use 'reverse_'<relation> as argument name.
--- a/hooks/zmq.py	Thu May 23 17:32:56 2013 +0200
+++ b/hooks/zmq.py	Wed May 29 16:44:16 2013 +0200
@@ -29,20 +29,23 @@
 class ZMQStartHook(hook.Hook):
     __regid__ = 'zmqstart'
     events = ('server_startup',)
+    order = -1
 
     def __call__(self):
         config = self.repo.config
         address_pub = config.get('zmq-address-pub')
-        if not address_pub:
+        address_sub = config.get('zmq-address-sub')
+        if not address_pub and not address_sub:
             return
         from cubicweb.server import cwzmq
         self.repo.app_instances_bus = cwzmq.ZMQComm()
-        self.repo.app_instances_bus.add_publisher(address_pub)
+        if address_pub:
+            self.repo.app_instances_bus.add_publisher(address_pub)
         def clear_cache_callback(msg):
             self.debug('clear_caches: %s', ' '.join(msg))
             self.repo.clear_caches(msg[1:])
         self.repo.app_instances_bus.add_subscription('delete', clear_cache_callback)
-        for address in config.get('zmq-address-sub'):
+        for address in address_sub:
             self.repo.app_instances_bus.add_subscriber(address)
         self.repo.app_instances_bus.start()
 
--- a/server/cwzmq.py	Thu May 23 17:32:56 2013 +0200
+++ b/server/cwzmq.py	Wed May 29 16:44:16 2013 +0200
@@ -78,7 +78,8 @@
         self._subscribers.append(subscriber)
 
     def publish(self, msg):
-        assert self.publisher is not None, "can't publish without a publisher"
+        if self.publisher is None:
+            return
         self.publisher.send(msg)
 
     def start(self):
--- a/server/serverconfig.py	Thu May 23 17:32:56 2013 +0200
+++ b/server/serverconfig.py	Wed May 29 16:44:16 2013 +0200
@@ -232,21 +232,21 @@
          {'type' : 'string',
           'default': None,
           'help': ('ZMQ URI on which the repository will be bound '
-                   'to (of the form `zmqpickle-tcp://<ipaddr><port>`).'),
+                   'to (of the form `zmqpickle-tcp://<ipaddr>:<port>`).'),
           'group': 'zmq', 'level': 3,
           }),
          ('zmq-address-sub',
           {'type' : 'csv',
            'default' : None,
            'help': ('List of ZMQ addresses to subscribe to (requires pyzmq) '
-                    '(of the form `zmqpickle-tcp://<ipaddr><port>`)'),
+                    '(of the form `zmqpickle-tcp://<ipaddr>:<port>`)'),
            'group': 'zmq', 'level': 1,
            }),
          ('zmq-address-pub',
           {'type' : 'string',
            'default' : None,
            'help': ('ZMQ address to use for publishing (requires pyzmq) '
-                    '(of the form `zmqpickle-tcp://<ipaddr><port>`)'),
+                    '(of the form `zmqpickle-tcp://<ipaddr>:<port>`)'),
            'group': 'zmq', 'level': 1,
            }),
         ) + CubicWebConfiguration.options)