# HG changeset patch # User Alexandre Fayolle # Date 1301492666 -7200 # Node ID 215275be4877847aa1642988cff65bd205d49da0 # Parent ef29d3ea390917579beb591d5b58a39e1242112f# Parent 8dd94fa7310a1cfcc44406d5de2dc382bb34a725 backport stable to default diff -r ef29d3ea3909 -r 215275be4877 doc/book/en/tutorials/advanced/part03_bfss.rst --- 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 diff -r ef29d3ea3909 -r 215275be4877 entities/__init__.py --- 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 ##################################################### diff -r ef29d3ea3909 -r 215275be4877 server/test/unittest_rql2sql.py --- 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