goa/tools/generate_schema_img.py
author sylvain.thenault@logilab.fr
Thu, 12 Mar 2009 19:39:34 +0100
branchtls-sprint
changeset 1101 0c067de38e46
parent 0 b97547f5f1fa
child 1802 d628defebc17
permissions -rw-r--r--
unification of meta-attributes handling: * remove has_format, has_text_encoding, format, text_encoding methods on Entity * remove rich_text_fields method on EntitySchema * use instead has_metadata / meta_attribute on EntitySchema (from yams) and attribute_metadata on Entity

import sys
from os.path import dirname, abspath, join
from yams import schema2dot 

APPLROOT = abspath(join(dirname(abspath(__file__)), '..'))

try:
    import custom
except ImportError:
    sys.path.insert(0, APPLROOT)
    import custom
    

schema = custom.SCHEMA
skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of')
path = join(APPLROOT, 'data', 'schema.png')
schema2dot.schema2dot(schema, path, #size=size,
                      skiprels=skip_rels, skipmeta=True)
print 'generated', path
path = join(APPLROOT, 'data', 'metaschema.png')
schema2dot.schema2dot(schema, path, #size=size,
                      skiprels=skip_rels, skipmeta=False)
print 'generated', path