goa/tools/laxctl.py
changeset 2126 a25859917ccc
parent 1977 606923dff11b
child 2476 1294a6bdf3bf
equal deleted inserted replaced
2123:3e1d2ab5f8c0 2126:a25859917ccc
    17 from Cookie import SimpleCookie
    17 from Cookie import SimpleCookie
    18 
    18 
    19 from logilab.common.clcommands import Command, register_commands, main_run
    19 from logilab.common.clcommands import Command, register_commands, main_run
    20 
    20 
    21 from cubicweb.common.uilib import remove_html_tags
    21 from cubicweb.common.uilib import remove_html_tags
       
    22 from cubicweb.web.views.schema import SKIP_TYPES
       
    23 
    22 APPLROOT = osp.abspath(osp.join(osp.dirname(osp.abspath(__file__)), '..'))
    24 APPLROOT = osp.abspath(osp.join(osp.dirname(osp.abspath(__file__)), '..'))
    23 
    25 
    24 
    26 
    25 def initialize_vregistry(applroot):
    27 def initialize_vregistry(applroot):
    26     # apply monkey patches first
    28     # apply monkey patches first
    55 
    57 
    56     def _run(self, args):
    58     def _run(self, args):
    57         assert not args, 'no argument expected'
    59         assert not args, 'no argument expected'
    58         from yams import schema2dot
    60         from yams import schema2dot
    59         schema = self.vreg.schema
    61         schema = self.vreg.schema
    60         skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of')
       
    61         path = osp.join(APPLROOT, 'data', 'schema.png')
    62         path = osp.join(APPLROOT, 'data', 'schema.png')
    62         schema2dot.schema2dot(schema, path, #size=size,
    63         schema2dot.schema2dot(schema, path, #size=size,
    63                               skiprels=skip_rels, skipmeta=True)
    64                               skiptypes=SKIP_TYPES)
    64         print 'generated', path
    65         print 'generated', path
    65         path = osp.join(APPLROOT, 'data', 'metaschema.png')
    66         path = osp.join(APPLROOT, 'data', 'metaschema.png')
    66         schema2dot.schema2dot(schema, path, #size=size,
    67         schema2dot.schema2dot(schema, path)
    67                               skiprels=skip_rels, skipmeta=False)
       
    68         print 'generated', path
    68         print 'generated', path
    69 
    69 
    70 
    70 
    71 class PopulateDataDirCommand(LaxCommand):
    71 class PopulateDataDirCommand(LaxCommand):
    72     """populate application's data directory according to used cubes"""
    72     """populate application's data directory according to used cubes"""