[entity,storage] remove hackish code from the bfss path
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 10 Jun 2014 18:17:07 +0200
changeset 10357 59a79300f213
parent 10356 a009a31fb1ea
child 10358 d551d0a162d5
[entity,storage] remove hackish code from the bfss path The ClientConnection/Connection duality brought some painful hacks that are no longer needed. Hence we can send entity._cw_update_attr_cache and ._cw_dont_cache_attribute to the grave. Related to #3837233
entity.py
server/sources/storages.py
--- a/entity.py	Fri Jun 13 15:56:08 2014 +0200
+++ b/entity.py	Tue Jun 10 18:17:07 2014 +0200
@@ -554,28 +554,6 @@
             return self.eid
         return super(Entity, self).__hash__()
 
-    def _cw_update_attr_cache(self, attrcache):
-        trdata = self._cw.transaction_data
-        uncached_attrs = trdata.get('%s.storage-special-process-attrs' % self.eid, set())
-        for attr in uncached_attrs:
-            attrcache.pop(attr, None)
-            self.cw_attr_cache.pop(attr, None)
-        self.cw_attr_cache.update(attrcache)
-
-    def _cw_dont_cache_attribute(self, attr, repo_side=False):
-        """Called when some attribute has been transformed by a *storage*,
-        hence the original value should not be cached **by anyone**.
-
-        For example we have a special "fs_importing" mode in BFSS
-        where a file path is given as attribute value and stored as is
-        in the data base. Later access to the attribute will provide
-        the content of the file at the specified path. We do not want
-        the "filepath" value to be cached.
-
-        """
-        trdata = self._cw.transaction_data
-        trdata.setdefault('%s.storage-special-process-attrs' % self.eid, set()).add(attr)
-
     def __json_encode__(self):
         """custom json dumps hook to dump the entity's eid
         which is not part of dict structure itself
--- a/server/sources/storages.py	Fri Jun 13 15:56:08 2014 +0200
+++ b/server/sources/storages.py	Tue Jun 10 18:17:07 2014 +0200
@@ -152,7 +152,6 @@
         """an entity using this storage for attr has been added"""
         if entity._cw.transaction_data.get('fs_importing'):
             binary = Binary.from_file(entity.cw_edited[attr].getvalue())
-            entity._cw_dont_cache_attribute(attr)
         else:
             binary = entity.cw_edited.pop(attr)
             fpath = self.new_fs_path(entity, attr)
@@ -171,7 +170,6 @@
             # We do not need to create it but we need to fetch the content of
             # the file as the actual content of the attribute
             fpath = entity.cw_edited[attr].getvalue()
-            entity._cw_dont_cache_attribute(attr)
             assert fpath is not None
             binary = Binary.from_file(fpath)
         else: