Changeset 3347 in products for quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
- Timestamp:
- Jan 31, 2012 12:20:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
r3339 r3347 26 26 # menu cache key conssits of: 27 27 # - selected item not only top tab 28 # - site can be accessed on different domains28 # - site can be accessed on different domains 29 29 # - language is important for multilingua sites 30 30 … … 44 44 path_key + \ 45 45 language + \ 46 str(time() // (60 * 5)) 47 48 # we are gcaching the menu structure built out of portal_actions tool 46 str(time() // (60 * 5)) 47 48 49 # we are caching the menu structure built out of portal_actions tool 49 50 # this cache key does not take in account expressions and roles settings 50 51 def tabs_cache_key(f, view, site_url): 51 52 return site_url + str(time() // (60 * 60)) 53 52 54 53 55 def dropdowncache(f): … … 55 57 portal_state = getMultiAdapter((view.context, view.request), 56 58 name=u'plone_portal_state') 57 # it is impossible to reliably cache entire rendered menu generated 59 # it is impossible to reliably cache entire rendered menu generated 58 60 # with potral actions strategy. 59 61 if not view.conf.enable_caching or view.conf.show_actions_tabs or \ … … 65 67 66 68 69 def tabscache(f): 70 def func(view, site_url): 71 if not view.conf.enable_caching: 72 return f(view, site_url) 73 return ram.cache(tabs_cache_key)(f)(view, site_url) 74 return func 75 76 67 77 class GlobalSectionsViewlet(common.GlobalSectionsViewlet): 68 78 index = ViewPageTemplateFile('templates/sections.pt') 69 79 recurse = ViewPageTemplateFile('templates/sections_recurse.pt') 70 71 80 72 81 def update(self): … … 143 152 return res 144 153 145 @ ram.cache(tabs_cache_key)154 @tabscache 146 155 def prepare_tabs(self, site_url): 147 156 def normalize_actions(category, object, level, parent_url=None):
Note: See TracChangeset
for help on using the changeset viewer.