--- a/server/schemaserial.py Mon Nov 23 14:55:36 2009 +0100
+++ b/server/schemaserial.py Mon Nov 23 14:56:24 2009 +0100
@@ -522,16 +522,20 @@
for action in erschema.ACTIONS:
for group in sorted(erschema.get_groups(action)):
try:
- yield ('SET X %s_permission Y WHERE X is %s, X name %%(name)s, Y eid %s'
- % (action, etype, groupmapping[group]), {'name': str(erschema)})
+ yield ('SET X %s_permission Y WHERE X is %s, X name %%(name)s, Y eid %%(g)s'
+ % (action, etype), {'name': str(erschema),
+ 'g': groupmapping[group]})
except KeyError:
continue
for rqlexpr in sorted(erschema.get_rqlexprs(action)):
yield ('INSERT RQLExpression E: E expression %%(e)s, E exprtype %%(t)s, '
'E mainvars %%(v)s, X %s_permission E '
- 'WHERE X is %s, X name "%s"' % (action, etype, erschema),
- {'e': unicode(rqlexpr.expression), 'v': unicode(rqlexpr.mainvars),
- 't': unicode(rqlexpr.__class__.__name__)})
+ 'WHERE X is %s, X name %%(name)s' % (action, etype),
+ {'e': unicode(rqlexpr.expression),
+ 'v': unicode(rqlexpr.mainvars),
+ 't': unicode(rqlexpr.__class__.__name__),
+ 'name': unicode(erschema)
+ })
def updateeschema2rql(eschema):
--- a/server/test/unittest_schemaserial.py Mon Nov 23 14:55:36 2009 +0100
+++ b/server/test/unittest_schemaserial.py Mon Nov 23 14:56:24 2009 +0100
@@ -143,35 +143,35 @@
def test_eperms2rql1(self):
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.eschema('CWEType'), self.GROUP_MAPPING)],
- ['SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 2',
- 'SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0',
- 'SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 1',
- 'SET X add_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0',
- 'SET X update_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0',
- 'SET X update_permission Y WHERE X is CWEType, X name "CWEType", Y eid 3',
- 'SET X delete_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0',
+ ['SET X read_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X add_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X update_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X update_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
+ 'SET X delete_permission Y WHERE X is CWEType, X name %(name)s, Y eid %(g)s',
])
def test_rperms2rql2(self):
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.rschema('read_permission'), self.GROUP_MAPPING)],
- ['SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 2',
- 'SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0',
- 'SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 1',
- 'SET X add_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0',
- 'SET X delete_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0',
+ ['SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X add_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X delete_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
])
def test_rperms2rql3(self):
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.rschema('name'), self.GROUP_MAPPING)],
- ['SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 2',
- 'SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 0',
- 'SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 1',
- 'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 2',
- 'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 0',
- 'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 1',
- 'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 2',
- 'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 0',
- 'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 1',
+ ['SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X read_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X add_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X add_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X add_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X delete_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X delete_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
+ 'SET X delete_permission Y WHERE X is CWRType, X name %(name)s, Y eid %(g)s',
])
#def test_perms2rql(self):