goa/tools/generate_schema_img.py
changeset 2126 a25859917ccc
parent 1977 606923dff11b
child 4212 ab6573088b4a
equal deleted inserted replaced
2123:3e1d2ab5f8c0 2126:a25859917ccc
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 """
     7 """
     8 import sys
     8 import sys
     9 from os.path import dirname, abspath, join
     9 from os.path import dirname, abspath, join
    10 from yams import schema2dot
    10 from yams import schema2dot
       
    11 from cubicweb.web.views.schema import SKIP_TYPES
    11 
    12 
    12 APPLROOT = abspath(join(dirname(abspath(__file__)), '..'))
    13 APPLROOT = abspath(join(dirname(abspath(__file__)), '..'))
    13 
    14 
    14 try:
    15 try:
    15     import custom
    16     import custom
    20 
    21 
    21 schema = custom.SCHEMA
    22 schema = custom.SCHEMA
    22 skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of')
    23 skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of')
    23 path = join(APPLROOT, 'data', 'schema.png')
    24 path = join(APPLROOT, 'data', 'schema.png')
    24 schema2dot.schema2dot(schema, path, #size=size,
    25 schema2dot.schema2dot(schema, path, #size=size,
    25                       skiprels=skip_rels, skipmeta=True)
    26                       skiptypes=SKIP_TYPES)
    26 print 'generated', path
    27 print 'generated', path
    27 path = join(APPLROOT, 'data', 'metaschema.png')
    28 path = join(APPLROOT, 'data', 'metaschema.png')
    28 schema2dot.schema2dot(schema, path, #size=size,
    29 schema2dot.schema2dot(schema, path)
    29                       skiprels=skip_rels, skipmeta=False)
       
    30 print 'generated', path
    30 print 'generated', path