Commit d69ee7dd authored by Jérome Perrin's avatar Jérome Perrin

core: workaround non initialized cache when viewing cache statistics

Probably this should be refactored more, but this is enough to make
TestXHTML pass now.
parent a2f117fa
......@@ -8,6 +8,10 @@ from Products.ERP5Type.Document import newTempBase
cache_stats = context.getPortalObject().portal_caches.getCacheTotalMemorySize()
cache_factory_list_stats = cache_stats['stats']
cache_factory_id = context.getParentValue().getId()
if cache_factory_id not in cache_factory_list_stats:
# If this cache factory is not in the stats, it means we have to
# update cache structure. XXX Probably an interaction should do this instead.
portal.portal_caches.updateCache()
cache_plugin_stats = cache_factory_list_stats[cache_factory_id]
cache_plugin_stats_data = cache_plugin_stats['cp_cache_keys_total_size']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment