backport stable to default
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Wed, 30 Mar 2011 15:44:26 +0200
changeset 7146 215275be4877
parent 7141 ef29d3ea3909 (current diff)
parent 7145 8dd94fa7310a (diff)
child 7147 db63a05b260e
backport stable to default
--- a/doc/book/en/tutorials/advanced/part03_bfss.rst	Wed Mar 30 11:17:58 2011 +0200
+++ b/doc/book/en/tutorials/advanced/part03_bfss.rst	Wed Mar 30 15:44:26 2011 +0200
@@ -20,7 +20,7 @@
     from os.path import join, exists
 
     from cubicweb.server import hook
-    from cubicweb.server.sources import storage
+    from cubicweb.server.sources import storages
 
     class ServerStartupHook(hook.Hook):
         __regid__ = 'sytweb.serverstartup'
@@ -38,7 +38,7 @@
 
   * how we built the hook's registry identifier (`__regid__`): you can introduce
     'namespaces' by using there python module like naming identifiers. This is
-    especially import for hooks where you usually want a new custom hook, not
+    especially important for hooks where you usually want a new custom hook, not
     overriding / specializing an existant one, but the concept may be applied to
     any application objects
 
--- a/entities/__init__.py	Wed Mar 30 11:17:58 2011 +0200
+++ b/entities/__init__.py	Wed Mar 30 15:44:26 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -121,16 +121,18 @@
     # edition helper functions ################################################
 
     def linked_to(self, rtype, role, remove=True):
-        """if entity should be linked to another using __linkto form param for
+        """if entity should be linked to another using '__linkto' form param for
         the given relation/role, return eids of related entities
 
         This method is consuming matching link-to information from form params
-        if `remove` is True (by default).
+        if `remove` is True (by default). Computed values are stored into a
+        `cw_linkto` attribute, a dictionary with (relation, role) as key and
+        linked eids as value.
         """
         try:
-            return self.__linkto[(rtype, role)]
+            return self.cw_linkto[(rtype, role)]
         except AttributeError:
-            self.__linkto = {}
+            self.cw_linkto = {}
         except KeyError:
             pass
         linktos = list(self._cw.list_form_param('__linkto'))
@@ -144,7 +146,7 @@
                     linktos.remove(linkto)
                     self._cw.form['__linkto'] = linktos
                 linkedto.append(typed_eid(eid))
-        self.__linkto[(rtype, role)] = linkedto
+        self.cw_linkto[(rtype, role)] = linkedto
         return linkedto
 
     # server side helpers #####################################################
--- a/server/test/unittest_rql2sql.py	Wed Mar 30 11:17:58 2011 +0200
+++ b/server/test/unittest_rql2sql.py	Wed Mar 30 15:44:26 2011 +0200
@@ -38,6 +38,7 @@
 except AssertionError, ex:
     pass # already registered
 
+
 from logilab import database as db
 def monkey_patch_import_driver_module(driver, drivers, quiet=True):
     if not driver in drivers:
@@ -53,7 +54,7 @@
                 print >> sys.stderr, '%s is not available' % modname
             continue
     else:
-        return None, drivers[driver][0]
+        return mock_object(STRING=1, BOOLEAN=2, BINARY=3, DATETIME=4, NUMBER=5), drivers[driver][0]
     return module, modname