Changeset 3347 in products
- Timestamp:
- Jan 31, 2012 12:20:31 PM (13 years ago)
- Location:
- quintagroup.dropdownmenu/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/README.txt
r3275 r3347 4 4 This package allows to build dropdown menu through the web with portal_actions. 5 5 Submenus are built from a tree of nested Category Actions and Actions. 6 6 7 The other strategy used to populate submenus is Plone default NavigationStrategy, 7 8 the one used in navigation portlet. … … 37 38 38 39 By default the root of dropdown menu is 'portal_tabs' category. 40 41 Menu caching 42 ============ 43 44 If the menu built with Navigation strategy is entirely public it can be cached for 45 all users. If Authenticaded users should see some non public items the menu can be 46 cached for anonymous only. 47 48 Caching in case of involving the portal_actions strategy is effective only in case 49 if all the action are public and have no extra conditions. In case some conditions 50 are applied per action switch off caching. 51 39 52 40 53 Compatibility … … 51 64 * install Plone DropDown Menu in Plone via Site Setup -> Add-ons 52 65 53 Find more details inside docs/INSTALL.txt 66 Find more details on the topic inside docs/INSTALL.txt 67 -
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): -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py
r3339 r3347 10 10 cachings = SimpleVocabulary( 11 11 [SimpleTerm(value=u'anonymous', title=_(u'Cache only for anonymous')), 12 SimpleTerm(value=u'all', title=_(u'Cache for all users')), ]12 SimpleTerm(value=u'all', title=_(u'Cache for all users')), ] 13 13 ) 14 14 15 15 16 class IDropDownMenuLayer(IDefaultPloneLayer): … … 83 84 default=u"_sub", 84 85 required=False) 85 86 86 87 enable_caching = schema.Bool( 87 88 title=_(u"Enable menu caching"), 88 89 description=_(u"Caching of the menu viewlet improves page rendering " 89 90 u"speed."), 90 default=True 91 default=True 91 92 ) 92 93 … … 95 96 description=_(u"Caching strategy defines how the cache key will be built."), 96 97 default="anonymous", 97 vocabulary=cachings 98 vocabulary=cachings 98 99 )
Note: See TracChangeset
for help on using the changeset viewer.