devtools/devctl.py
branch3.5
changeset 3221 3422d2188940
parent 3118 9e7a155bc4e5
child 3230 1d25e928c299
child 3275 5247789df541
equal deleted inserted replaced
3220:11b6016e3970 3221:3422d2188940
    21 from logilab.common.clcommands import register_commands
    21 from logilab.common.clcommands import register_commands
    22 
    22 
    23 from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage, underline_title
    23 from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage, underline_title
    24 from cubicweb.__pkginfo__ import version as cubicwebversion
    24 from cubicweb.__pkginfo__ import version as cubicwebversion
    25 from cubicweb.toolsutils import Command, copy_skeleton
    25 from cubicweb.toolsutils import Command, copy_skeleton
       
    26 from cubicweb.web import uicfg
    26 from cubicweb.web.webconfig import WebConfiguration
    27 from cubicweb.web.webconfig import WebConfiguration
    27 from cubicweb.server.serverconfig import ServerConfiguration
    28 from cubicweb.server.serverconfig import ServerConfiguration
    28 
    29 
    29 class DevCubeConfiguration(ServerConfiguration, WebConfiguration):
    30 class DevCubeConfiguration(ServerConfiguration, WebConfiguration):
    30     """dummy config to get full library schema and entities"""
    31     """dummy config to get full library schema and entities"""
   149         if rschema.description and rschema.description not in done:
   150         if rschema.description and rschema.description not in done:
   150             done.add(rschema.description)
   151             done.add(rschema.description)
   151             add_msg(w, rschema.description)
   152             add_msg(w, rschema.description)
   152     w('# add related box generated message\n')
   153     w('# add related box generated message\n')
   153     w('\n')
   154     w('\n')
   154     actionbox = vreg['boxes']['edit_box'][0]
   155     appearsin_addmenu = uicfg.actionbox_appearsin_addmenu
   155     for eschema in schema.entities():
   156     for eschema in schema.entities():
   156         if eschema.is_final():
   157         if eschema.is_final():
   157             continue
   158             continue
   158         for role, rschemas in (('subject', eschema.subject_relations()),
   159         for role, rschemas in (('subject', eschema.subject_relations()),
   159                             ('object', eschema.object_relations())):
   160                             ('object', eschema.object_relations())):
   168                             subjtype, objtype = eschema, teschema
   169                             subjtype, objtype = eschema, teschema
   169                         else:
   170                         else:
   170                             subjtype, objtype = teschema, eschema
   171                             subjtype, objtype = teschema, eschema
   171                         if librschema.has_rdef(subjtype, objtype):
   172                         if librschema.has_rdef(subjtype, objtype):
   172                             continue
   173                             continue
   173                     if actionbox.appearsin_addmenu.etype_get(eschema, rschema,
   174                     if appearsin_addmenu.etype_get(eschema, rschema, role,
   174                                                              role, teschema):
   175                                                    teschema):
   175                         if role == 'subject':
   176                         if role == 'subject':
   176                             label = 'add %s %s %s %s' % (eschema, rschema,
   177                             label = 'add %s %s %s %s' % (eschema, rschema,
   177                                                          teschema, role)
   178                                                          teschema, role)
   178                             label2 = "creating %s (%s %%(linkto)s %s %s)" % (
   179                             label2 = "creating %s (%s %%(linkto)s %s %s)" % (
   179                                 teschema, eschema, rschema, teschema)
   180                                 teschema, eschema, rschema, teschema)