# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1242198562 -7200 # Node ID fb91d2b8a4413142a646813c442d6e212330e1cf # Parent b59b7c422a8a7714cf0fe646523cd10168df2bc4 fix some rtags pb on i18n catalog generation diff -r b59b7c422a8a -r fb91d2b8a441 cwvreg.py --- a/cwvreg.py Wed May 13 08:41:23 2009 +0200 +++ b/cwvreg.py Wed May 13 09:09:22 2009 +0200 @@ -5,6 +5,7 @@ :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" +_ = unicode from logilab.common.decorators import cached, clear_cache @@ -12,8 +13,8 @@ from cubicweb import Binary, UnknownProperty, UnknownEid from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject +from cubicweb.rtags import RTAGS -_ = unicode def use_interfaces(obj): """return interfaces used by the given object by searchinf for implements @@ -122,9 +123,10 @@ for appobjects in objects.itervalues(): for appobject in appobjects: appobject.vreg_initialization_completed() - from cubicweb.rtags import RTAGS + # don't check rtags if we don't want to cleanup_interface_sobjects for rtag in RTAGS: - rtag.init(self.schema) + rtag.init(self.schema, + check=self.config.cleanup_interface_sobjects) def initialization_completed(self): # clear etype cache if you don't want to run into deep weirdness diff -r b59b7c422a8a -r fb91d2b8a441 devtools/devctl.py --- a/devtools/devctl.py Wed May 13 08:41:23 2009 +0200 +++ b/devtools/devctl.py Wed May 13 09:09:22 2009 +0200 @@ -77,6 +77,11 @@ if mod.__file__.startswith(path): del sys.modules[name] break + # fresh rtags + from cubicweb import rtags + from cubicweb.web import uicfg + rtags.RTAGS[:] = [] + reload(uicfg) def generate_schema_pot(w, cubedir=None): """generate a pot file with schema specific i18n messages diff -r b59b7c422a8a -r fb91d2b8a441 rtags.py --- a/rtags.py Wed May 13 08:41:23 2009 +0200 +++ b/rtags.py Wed May 13 09:09:22 2009 +0200 @@ -30,7 +30,7 @@ self._allowed_values = allowed_values self._initfunc = initfunc register_rtag(self) - + def __repr__(self): return repr(self._tagdefs) @@ -52,14 +52,16 @@ keys.remove((rtype, tagged, stype, '*')) return keys - def init(self, schema): + def init(self, schema, check=True): # XXX check existing keys against schema - for (rtype, tagged, stype, otype), value in self._tagdefs.items(): - for ertype in (stype, rtype, otype): - if ertype != '*' and not ertype in schema: - self.warning('removing rtag %s: %s, %s undefined in schema', - (stype, rtype, otype, tagged), value, ertype) - self.del_rtag(stype, rtype, otype, tagged) + if check: + for (rtype, tagged, stype, otype), value in self._tagdefs.items(): + for ertype in (stype, rtype, otype): + if ertype != '*' and not ertype in schema: + self.warning('removing rtag %s: %s, %s undefined in schema', + (stype, rtype, otype, tagged), value, ertype) + self.del_rtag(stype, rtype, otype, tagged) + break if self._initfunc is not None: for eschema in schema.entities(): for rschema, tschemas, role in eschema.relation_definitions(True):