[repository] fix crash in optimized [add|remove]_relation w/ inlined relation (broken by cw 3.10 refactoring)
--- a/server/session.py Mon Mar 28 16:39:49 2011 +0200
+++ b/server/session.py Mon Mar 28 16:41:36 2011 +0200
@@ -37,6 +37,7 @@
from cubicweb.dbapi import ConnectionProperties
from cubicweb.utils import make_uid, RepeatList
from cubicweb.rqlrewrite import RQLRewriter
+from cubicweb.server.edition import EditedEntity
ETYPE_PYOBJ_MAP[Binary] = 'Bytes'
@@ -215,8 +216,9 @@
with security_enabled(self, False, False):
if self.vreg.schema[rtype].inlined:
entity = self.entity_from_eid(fromeid)
- entity[rtype] = toeid
- self.repo.glob_update_entity(self, entity, set((rtype,)))
+ edited = EditedEntity(entity)
+ edited.edited_attribute(rtype, toeid)
+ self.repo.glob_update_entity(self, edited)
else:
self.repo.glob_add_relation(self, fromeid, rtype, toeid)
@@ -234,7 +236,7 @@
with security_enabled(self, False, False):
if self.vreg.schema[rtype].inlined:
entity = self.entity_from_eid(fromeid)
- entity[rtype] = None
+ entity.cw_attr_cache[rtype] = None
self.repo.glob_update_entity(self, entity, set((rtype,)))
else:
self.repo.glob_delete_relation(self, fromeid, rtype, toeid)