[entity attr cache] mark attribute as uncacheable in the underlying function else we may miss some changes.
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 11 Sep 2012 12:42:26 +0200
changeset 8581 ac3cbf55d9fb
parent 8580 d753d6a6798f
child 8592 df16bd045cae
[entity attr cache] mark attribute as uncacheable in the underlying function else we may miss some changes. Also rewrite a storage test currently failing because cache of the entity created by the test transaction, distinct from the entity created internally and given to hooks and all, has its attributes cache not updated. As this doesn't seems a proper usage, rewrite it as expected. Much probably closes #2423719 definitly.
server/edition.py
server/test/unittest_storage.py
--- a/server/edition.py	Fri Oct 05 16:54:22 2012 +0200
+++ b/server/edition.py	Tue Sep 11 12:42:26 2012 +0200
@@ -61,8 +61,6 @@
         # attributes, else we may accidentaly skip a desired security check
         if attr not in self:
             self.skip_security.add(attr)
-        # mark attribute as needing purge by the client
-        self.entity._cw_dont_cache_attribute(attr)
         self.edited_attribute(attr, value)
 
     def __delitem__(self, attr):
@@ -105,6 +103,8 @@
         assert not self.saved, 'too late to modify edited attributes'
         super(EditedEntity, self).__setitem__(attr, value)
         self.entity.cw_attr_cache[attr] = value
+        # mark attribute as needing purge by the client
+        self.entity._cw_dont_cache_attribute(attr)
 
     def oldnewvalue(self, attr):
         """returns the couple (old attr value, new attr value)
--- a/server/test/unittest_storage.py	Fri Oct 05 16:54:22 2012 +0200
+++ b/server/test/unittest_storage.py	Tue Sep 11 12:42:26 2012 +0200
@@ -118,7 +118,7 @@
     def test_bfss_fs_importing_doesnt_touch_path(self):
         self.session.transaction_data['fs_importing'] = True
         filepath = osp.abspath(__file__)
-        f1 = self.session.create_entity('File', data=Binary(filepath),
+        f1 = self.request().create_entity('File', data=Binary(filepath),
                                         data_format=u'text/plain', data_name=u'foo')
         self.assertEqual(self.fspath(f1), filepath)