Comment 5 for bug 903929

Revision history for this message
Dimitri John Ledkov (ex-credativ) (dle-credativ) wrote :

Hmmm.... in trunk browse_record class has refresh function which does what we want.
We can possibly backport this for our purposes =)

    def refresh(self):
        """Force refreshing this browse_record's data and all the data of the
           records that belong to the same cache, by emptying the cache completely,
           preserving only the record identifiers (for prefetching optimizations).
        """
        for model, model_cache in self._cache.iteritems():
            # only preserve the ids of the records that were in the cache
            cached_ids = dict([(i, {'id': i}) for i in model_cache.keys()])
            self._cache[model].clear()
            self._cache[model].update(cached_ids)