# HG changeset patch # User Sylvain Thénault # Date 1261506419 -3600 # Node ID bd552b341334f4ae759db258ef0ebc154b22d4e6 # Parent b3258d2afe04c12c26782ac467324ccf77715083 make groupmap argument optional / sort for testing purpose diff -r b3258d2afe04 -r bd552b341334 server/schemaserial.py --- a/server/schemaserial.py Tue Dec 22 19:26:12 2009 +0100 +++ b/server/schemaserial.py Tue Dec 22 19:26:59 2009 +0100 @@ -400,7 +400,7 @@ if subjtype is None: assert objtype is None assert props is None - targets = rschema.rdefs + targets = sorted(rschema.rdefs) else: assert not objtype is None targets = [(subjtype, objtype)] @@ -449,7 +449,7 @@ return eschema2rql(erschema, groupmap=groupmap) return rschema2rql(erschema, groupmap=groupmap) -def eschema2rql(eschema, groupmap): +def eschema2rql(eschema, groupmap=None): """return a list of rql insert statements to enter an entity schema in the database as an CWEType entity """ @@ -457,10 +457,11 @@ # NOTE: 'specializes' relation can't be inserted here since there's no # way to make sure the parent type is inserted before the child type yield 'INSERT CWEType X: %s' % ','.join(relations) , values - # entity schema - for rql, args in _erperms2rql(eschema, groupmap): - args['name'] = str(eschema) - yield rql + 'X is CWEType, X name %(name)s', args + # entity permissions + if groupmap is not None: + for rql, args in _erperms2rql(eschema, groupmap): + args['name'] = str(eschema) + yield rql + 'X is CWEType, X name %(name)s', args def specialize2rql(schema): for eschema in schema.entities():