entity.py
changeset 7246 ecae5b526437
parent 7223 7a58581d842c
child 7288 b156200ebc9d
child 7293 97505b798975
--- a/entity.py	Thu Apr 14 14:18:46 2011 +0200
+++ b/entity.py	Fri Apr 22 12:17:51 2011 +0200
@@ -266,7 +266,6 @@
         restrictions = set()
         pending_relations = []
         eschema = cls.e_schema
-        cache = {}
         for attr, value in kwargs.items():
             if attr.startswith('reverse_'):
                 attr = attr[len('reverse_'):]
@@ -275,9 +274,7 @@
                 role = 'subject'
             assert eschema.has_relation(attr, role)
             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
-            if rschema.final:
-                cache[attr] = value # XXX what if value is processed in pre add hook (eg timeseries)?
-            elif isinstance(value, (tuple, list, set, frozenset)):
+            if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
                 if len(value) == 1:
                     value = iter(value).next()
                 else:
@@ -302,7 +299,6 @@
         if restrictions:
             rql = '%s WHERE %s' % (rql, ', '.join(restrictions))
         created = execute(rql, kwargs).get_entity(0, 0)
-        created.cw_attr_cache.update(cache)
         for attr, values in pending_relations:
             if attr.startswith('reverse_'):
                 restr = 'Y %s X' % attr[len('reverse_'):]