Changeset 3239 in products for quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
- Timestamp:
- Jun 20, 2011 1:52:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
r3236 r3239 25 25 26 26 def menu_cache_key(f, view): 27 try: 28 section = view.context.getPhysicalPath()[2] 29 except: 30 section = "" 31 27 portal_state = getMultiAdapter((view.context, view.request), 28 name=u'plone_portal_state') 29 site_len = len(portal_state.navigation_root_path().split('/')) 30 content_path = view.context.getPhysicalPath()[site_len:] 31 if view.conf.content_tabs_level > 0: 32 content_path = content_path[:view.conf.content_tabs_level] 33 path_key = '/'.join(content_path) 32 34 return view.__name__ + \ 33 section+ \35 path_key + \ 34 36 str(time() // (60 * 5)) # Every five minutes 35 37 # Note that the HTTP RAM-cache … … 37 39 # 60 minutes. 38 40 39 40 41 def tabs_cache_key(f, view, site_url): 41 42 return site_url + str(time() // (60 * 60)) 43 44 def dropdowncache(f): 45 def func(view): 46 if view.conf.show_actions_tabs: 47 return f(view) 48 return ram.cache(menu_cache_key)(f)(view) 49 return func 42 50 43 51 … … 221 229 return getDropDownMenuSettings(self.context) 222 230 223 @ ram.cache(menu_cache_key)231 @dropdowncache 224 232 def createMenu(self): 225 233 html = self.recurse(children=self.portal_tabs, level=1)
Note: See TracChangeset
for help on using the changeset viewer.