devtools/devctl.py
changeset 8666 1dd655788ece
parent 8665 e65af61bde7d
child 8695 358d8bed9626
equal deleted inserted replaced
8665:e65af61bde7d 8666:1dd655788ece
    93             continue
    93             continue
    94         for path in config.appobjects_path():
    94         for path in config.appobjects_path():
    95             if mod.__file__.startswith(path):
    95             if mod.__file__.startswith(path):
    96                 del sys.modules[name]
    96                 del sys.modules[name]
    97                 break
    97                 break
    98     # fresh rtags
       
    99     from cubicweb import rtags
       
   100     from cubicweb.web.views import uicfg
       
   101     rtags.RTAGS[:] = []
       
   102     reload(uicfg)
       
   103 
    98 
   104 def generate_schema_pot(w, cubedir=None):
    99 def generate_schema_pot(w, cubedir=None):
   105     """generate a pot file with schema specific i18n messages
   100     """generate a pot file with schema specific i18n messages
   106 
   101 
   107     notice that relation definitions description and static vocabulary
   102     notice that relation definitions description and static vocabulary
   127 
   122 
   128 
   123 
   129 def _generate_schema_pot(w, vreg, schema, libconfig=None):
   124 def _generate_schema_pot(w, vreg, schema, libconfig=None):
   130     from copy import deepcopy
   125     from copy import deepcopy
   131     from cubicweb.i18n import add_msg
   126     from cubicweb.i18n import add_msg
   132     from cubicweb.web.views import uicfg
       
   133     from cubicweb.schema import NO_I18NCONTEXT, CONSTRAINTS
   127     from cubicweb.schema import NO_I18NCONTEXT, CONSTRAINTS
   134     w('# schema pot file, generated on %s\n'
   128     w('# schema pot file, generated on %s\n'
   135       % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
   129       % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
   136     w('# \n')
   130     w('# \n')
   137     w('# singular and plural forms for each entity type\n')
   131     w('# singular and plural forms for each entity type\n')
   138     w('\n')
   132     w('\n')
   139     vregdone = set()
   133     vregdone = set()
   140     if libconfig is not None:
   134     if libconfig is not None:
   141         from cubicweb.cwvreg import CWRegistryStore, clear_rtag_objects
   135         from cubicweb.cwvreg import CWRegistryStore
   142         libschema = libconfig.load_schema(remove_unused_rtypes=False)
   136         libschema = libconfig.load_schema(remove_unused_rtypes=False)
   143         afs = deepcopy(uicfg.autoform_section)
   137         afs = vreg['uicfg'].select('autoform_section')
   144         appearsin_addmenu = deepcopy(uicfg.actionbox_appearsin_addmenu)
   138         appearsin_addmenu = vreg['uicfg'].select('actionbox_appearsin_addmenu')
   145         clear_rtag_objects()
       
   146         cleanup_sys_modules(libconfig)
   139         cleanup_sys_modules(libconfig)
   147         libvreg = CWRegistryStore(libconfig)
   140         libvreg = CWRegistryStore(libconfig)
   148         libvreg.set_schema(libschema) # trigger objects registration
   141         libvreg.set_schema(libschema) # trigger objects registration
   149         libafs = uicfg.autoform_section
   142         libafs = libvreg['uicfg'].select('autoform_section')
   150         libappearsin_addmenu = uicfg.actionbox_appearsin_addmenu
   143         libappearsin_addmenu = libvreg['uicfg'].select('actionbox_appearsin_addmenu')
   151         # prefill vregdone set
   144         # prefill vregdone set
   152         list(_iter_vreg_objids(libvreg, vregdone))
   145         list(_iter_vreg_objids(libvreg, vregdone))
   153     else:
   146     else:
   154         libschema = {}
   147         libschema = {}
   155         afs = uicfg.autoform_section
   148         afs = vreg['uicfg'].select('autoform_section')
   156         appearsin_addmenu = uicfg.actionbox_appearsin_addmenu
   149         appearsin_addmenu = vreg['uicfg'].select('actionbox_appearsin_addmenu')
   157         for cstrtype in CONSTRAINTS:
   150         for cstrtype in CONSTRAINTS:
   158             add_msg(w, cstrtype)
   151             add_msg(w, cstrtype)
   159     done = set()
   152     done = set()
   160     for eschema in sorted(schema.entities()):
   153     for eschema in sorted(schema.entities()):
   161         if eschema.type in libschema:
   154         if eschema.type in libschema: