[repository] fix crash in optimized [add|remove]_relation w/ inlined relation (broken by cw 3.10 refactoring) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 28 Mar 2011 16:41:36 +0200
branchstable
changeset 7119 8b29c4c2ffc6
parent 7118 e094b3d4eb95
child 7120 e8b6fc55df2d
[repository] fix crash in optimized [add|remove]_relation w/ inlined relation (broken by cw 3.10 refactoring)
server/session.py
--- 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)