--- a/server/migractions.py Tue Sep 07 23:23:16 2010 +0200
+++ b/server/migractions.py Tue Sep 07 23:24:45 2010 +0200
@@ -710,13 +710,8 @@
targeted type is known
"""
instschema = self.repo.schema
- assert not etype in instschema
- # # XXX (syt) plz explain: if we're adding an entity type, it should
- # # not be there...
- # eschema = instschema[etype]
- # if eschema.final:
- # instschema.del_entity_type(etype)
- # else:
+ assert not etype in instschema, \
+ '%s already defined in the instance schema' % etype
eschema = self.fs_schema.eschema(etype)
confirm = self.verbosity >= 2
groupmap = self.group_mapping()
--- a/server/repository.py Tue Sep 07 23:23:16 2010 +0200
+++ b/server/repository.py Tue Sep 07 23:24:45 2010 +0200
@@ -81,14 +81,14 @@
# not expected for this). So: don't do it, we pretend to ensure repository
# consistency.
#
- # XXX we don't want read permissions to be applied but we want delete
- # permission to be checked
- rschema = session.repo.schema.rschema(rtype)
- if card[0] in '1?':
- if not rschema.inlined: # inlined relations will be implicitly deleted
- with security_enabled(session, read=False):
- session.execute('DELETE X %s Y WHERE X eid %%(x)s, '
- 'NOT Y eid %%(y)s' % rtype,
+ # notes:
+ # * inlined relations will be implicitly deleted for the subject entity
+ # * we don't want read permissions to be applied but we want delete
+ # permission to be checked
+ if card[0] in '1?' and not session.repo.schema.rschema(rtype).inlined:
+ with security_enabled(session, read=False):
+ session.execute('DELETE X %s Y WHERE X eid %%(x)s, '
+ 'NOT Y eid %%(y)s' % rtype,
{'x': eidfrom, 'y': eidto})
if card[1] in '1?':
with security_enabled(session, read=False):
@@ -1080,7 +1080,7 @@
if rtype in schema.VIRTUAL_RTYPES:
continue
entity.cw_set_relation_cache(rtype, 'object', session.empty_rset())
- # set inline relation cache before call to after_add_entity
+ # set inlined relation cache before call to after_add_entity
for attr, value in relations:
session.update_rel_cache_add(entity.eid, attr, value)
del_existing_rel_if_needed(session, entity.eid, attr, value)
--- a/server/schemaserial.py Tue Sep 07 23:23:16 2010 +0200
+++ b/server/schemaserial.py Tue Sep 07 23:24:45 2010 +0200
@@ -190,8 +190,8 @@
rdefeid, seid, reid, teid, card, ord, desc, c = values
rdef = ybo.RelationDefinition(sidx[seid].type, sidx[reid].type, sidx[teid].type,
constraints=cstrsdict.get(rdefeid, ()),
- cardinality=card, order=ord, description=desc,
- composite=c, eid=rdefeid)
+ cardinality=card, composite=c,
+ description=desc, order=ord, eid=rdefeid)
rdefs = schema.add_relation_def(rdef)
# rdefs can be None on duplicated relation definitions (e.g. symmetrics)
if rdefs is not None:
--- a/server/test/unittest_querier.py Tue Sep 07 23:23:16 2010 +0200
+++ b/server/test/unittest_querier.py Tue Sep 07 23:24:45 2010 +0200
@@ -1072,14 +1072,14 @@
self.commit()
# fill the cache
self.execute("Any X WHERE X eid %(x)s", {'x': eid})
- self.execute("Any X WHERE X eid %s" %eid)
+ self.execute("Any X WHERE X eid %s" % eid)
self.execute("Folder X WHERE X eid %(x)s", {'x': eid})
- self.execute("Folder X WHERE X eid %s" %eid)
- self.execute("DELETE Folder T WHERE T eid %s"%eid)
+ self.execute("Folder X WHERE X eid %s" % eid)
+ self.execute("DELETE Folder T WHERE T eid %s" % eid)
self.commit()
rset = self.execute("Any X WHERE X eid %(x)s", {'x': eid})
self.assertEquals(rset.rows, [])
- rset = self.execute("Any X WHERE X eid %s" %eid)
+ rset = self.execute("Any X WHERE X eid %s" % eid)
self.assertEquals(rset.rows, [])
rset = self.execute("Folder X WHERE X eid %(x)s", {'x': eid})
self.assertEquals(rset.rows, [])