tweak catalog generation by adding a new SYSTEM_RTYPES set to schema 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 17 Sep 2009 13:21:13 +0200
branch3.5
changeset 3287 19c1011736a6
parent 3286 d4922a5d0754
child 3288 266d31e7afa0
tweak catalog generation by adding a new SYSTEM_RTYPES set to schema
devtools/devctl.py
schema.py
--- a/devtools/devctl.py	Thu Sep 17 12:30:53 2009 +0200
+++ b/devtools/devctl.py	Thu Sep 17 13:21:13 2009 +0200
@@ -23,7 +23,6 @@
 
 from cubicweb import (CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage,
                       underline_title)
-from cubicweb.schema import META_RTYPES
 from cubicweb.__pkginfo__ import version as cubicwebversion
 from cubicweb.toolsutils import Command, copy_skeleton
 from cubicweb.web.webconfig import WebConfiguration
@@ -115,6 +114,8 @@
 def _generate_schema_pot(w, vreg, schema, libconfig=None, cube=None):
     from cubicweb.common.i18n import add_msg
     from cubicweb.web import uicfg
+    from cubicweb.schema import META_RTYPES, SYSTEM_RTYPES
+    no_context_rtypes = META_RTYPES | SYSTEM_RTYPES
     w('# schema pot file, generated on %s\n' % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
     w('# \n')
     w('# singular and plural forms for each entity type\n')
@@ -191,13 +192,13 @@
         else:
             librschema = libschema.rschema(rtype)
         # add context information only for non-metadata rtypes
-        if rschema not in META_RTYPES:
+        if rschema not in no_context_rtypes:
             libsubjects = librschema and librschema.subjects() or ()
             for subjschema in rschema.subjects():
                 if not subjschema in libsubjects:
                     add_msg(w, rtype, subjschema.type)
         if not (schema.rschema(rtype).is_final() or rschema.symetric):
-            if rschema not in META_RTYPES:
+            if rschema not in no_context_rtypes:
                 libobjects = librschema and librschema.objects() or ()
                 for objschema in rschema.objects():
                     if not objschema in libobjects:
--- a/schema.py	Thu Sep 17 12:30:53 2009 +0200
+++ b/schema.py	Thu Sep 17 13:21:13 2009 +0200
@@ -44,6 +44,7 @@
     'owned_by', 'created_by', 'is', 'is_instance_of', 'identity',
     'eid', 'creation_date', 'modification_date', 'has_text', 'cwuri',
     ))
+SYSTEM_RTYPES = set(('require_permission', 'custom_workflow', 'in_state', 'wf_info_for'))
 
 #  set of entity and relation types used to build the schema
 SCHEMA_TYPES = set((