[dataimport] ObjectStore.create_entity should return something that looks like an entity (eg no more using dict protocol to access to attributes) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 01 Apr 2011 01:06:37 +0200
branchstable
changeset 7159 3bcccd3ab6b6
parent 7158 0f31a50b144e
child 7160 923013173031
[dataimport] ObjectStore.create_entity should return something that looks like an entity (eg no more using dict protocol to access to attributes)
dataimport.py
--- a/dataimport.py	Fri Apr 01 01:06:29 2011 +0200
+++ b/dataimport.py	Fri Apr 01 01:06:37 2011 +0200
@@ -74,7 +74,7 @@
 from copy import copy
 from datetime import datetime
 
-from logilab.common import shellutils
+from logilab.common import shellutils, attrdict
 from logilab.common.date import strptime
 from logilab.common.decorators import cached
 from logilab.common.deprecation import deprecated
@@ -305,7 +305,8 @@
         return len(self.items) - 1
 
     def create_entity(self, etype, **data):
-        data['eid'] =  eid = self._put(etype, data)
+        data = attrdict(data)
+        data['eid'] = eid = self._put(etype, data)
         self.eids[eid] = data
         self.types.setdefault(etype, []).append(eid)
         return data