devtools/devctl.py
branch3.5
changeset 3287 19c1011736a6
parent 3286 d4922a5d0754
child 3293 69c0ba095536
child 3327 44efba78afac
equal deleted inserted replaced
3286:d4922a5d0754 3287:19c1011736a6
    21 from logilab.common.shellutils import ASK
    21 from logilab.common.shellutils import ASK
    22 from logilab.common.clcommands import register_commands
    22 from logilab.common.clcommands import register_commands
    23 
    23 
    24 from cubicweb import (CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage,
    24 from cubicweb import (CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage,
    25                       underline_title)
    25                       underline_title)
    26 from cubicweb.schema import META_RTYPES
       
    27 from cubicweb.__pkginfo__ import version as cubicwebversion
    26 from cubicweb.__pkginfo__ import version as cubicwebversion
    28 from cubicweb.toolsutils import Command, copy_skeleton
    27 from cubicweb.toolsutils import Command, copy_skeleton
    29 from cubicweb.web.webconfig import WebConfiguration
    28 from cubicweb.web.webconfig import WebConfiguration
    30 from cubicweb.server.serverconfig import ServerConfiguration
    29 from cubicweb.server.serverconfig import ServerConfiguration
    31 
    30 
   113 
   112 
   114 
   113 
   115 def _generate_schema_pot(w, vreg, schema, libconfig=None, cube=None):
   114 def _generate_schema_pot(w, vreg, schema, libconfig=None, cube=None):
   116     from cubicweb.common.i18n import add_msg
   115     from cubicweb.common.i18n import add_msg
   117     from cubicweb.web import uicfg
   116     from cubicweb.web import uicfg
       
   117     from cubicweb.schema import META_RTYPES, SYSTEM_RTYPES
       
   118     no_context_rtypes = META_RTYPES | SYSTEM_RTYPES
   118     w('# schema pot file, generated on %s\n' % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
   119     w('# schema pot file, generated on %s\n' % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
   119     w('# \n')
   120     w('# \n')
   120     w('# singular and plural forms for each entity type\n')
   121     w('# singular and plural forms for each entity type\n')
   121     w('\n')
   122     w('\n')
   122     vregdone = set()
   123     vregdone = set()
   189             done.add(rtype)
   190             done.add(rtype)
   190             librschema = None
   191             librschema = None
   191         else:
   192         else:
   192             librschema = libschema.rschema(rtype)
   193             librschema = libschema.rschema(rtype)
   193         # add context information only for non-metadata rtypes
   194         # add context information only for non-metadata rtypes
   194         if rschema not in META_RTYPES:
   195         if rschema not in no_context_rtypes:
   195             libsubjects = librschema and librschema.subjects() or ()
   196             libsubjects = librschema and librschema.subjects() or ()
   196             for subjschema in rschema.subjects():
   197             for subjschema in rschema.subjects():
   197                 if not subjschema in libsubjects:
   198                 if not subjschema in libsubjects:
   198                     add_msg(w, rtype, subjschema.type)
   199                     add_msg(w, rtype, subjschema.type)
   199         if not (schema.rschema(rtype).is_final() or rschema.symetric):
   200         if not (schema.rschema(rtype).is_final() or rschema.symetric):
   200             if rschema not in META_RTYPES:
   201             if rschema not in no_context_rtypes:
   201                 libobjects = librschema and librschema.objects() or ()
   202                 libobjects = librschema and librschema.objects() or ()
   202                 for objschema in rschema.objects():
   203                 for objschema in rschema.objects():
   203                     if not objschema in libobjects:
   204                     if not objschema in libobjects:
   204                         add_msg(w, '%s_object' % rtype, objschema.type)
   205                         add_msg(w, '%s_object' % rtype, objschema.type)
   205             if rtype not in libschema:
   206             if rtype not in libschema: