Changeset 3514 in products
- Timestamp:
- Aug 22, 2012 12:40:59 PM (12 years ago)
- Location:
- quintagroup.dropdownmenu/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/controlpanel.py
r3511 r3514 50 50 label = translate(term.title, context=widget.request, 51 51 default=term.title) 52 widget.items.append({'id': id, 'name': widget.name + ':list', 52 widget.items.append({ 53 'id': id, 'name': widget.name + ':list', 53 54 'value': term.token, 'label': label, 'checked': checked}) 54 55 -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
r3491 r3514 43 43 # typically purges entries after 60 minutes. 44 44 return view.__name__ + \ 45 46 47 45 path_key + \ 46 language + \ 47 str(time() // (60 * 5)) 48 48 49 49 … … 57 57 def func(view): 58 58 portal_state = getMultiAdapter((view.context, view.request), 59 59 name=u'plone_portal_state') 60 60 # it is impossible to reliably cache entire rendered menu generated 61 61 # with potral actions strategy. 62 62 if not view.conf.enable_caching or view.conf.show_actions_tabs or \ 63 (not portal_state.anonymous() and \63 (not portal_state.anonymous() and 64 64 view.conf.caching_strategy == 'anonymous'): 65 65 return f(view) … … 91 91 self.site_url = getToolByName(context, 'portal_url')() 92 92 self.context_state = getMultiAdapter((self.context, self.request), 93 93 name="plone_context_state") 94 94 self.context_url = self.context_state.is_default_page() and \ 95 95 '/'.join(self.context.absolute_url().split('/')[:-1]) or \ … … 120 120 conf = self.conf 121 121 tool = self.tool 122 url = self.context_url 123 starts = url.startswith 122 124 123 125 # check if we have required root actions category inside tool … … 136 138 delta = 1000 137 139 for info in listtabs: 138 if self.context_url.startswith(info['url']) and \ 139 len(self.context_url) - len(info['url']) < delta: 140 if starts(info['url']) and len(url) - len(info['url']) < delta: 140 141 delta = len(self.context_url) - len(info['url']) 141 142 current_item = listtabs.index(info) 142 143 self.id_chain = [] 143 144 144 if current_item > -1 and current_item < len(listtabs) and \ 145 (listtabs[current_item]['url'] != self.site_url or \ 146 listtabs[current_item]['url'] == self.site_url and \ 147 self.context_url == self.site_url): 148 145 active = listtabs[current_item]['url'] == self.site_url 146 active = active and self.context_url == self.site_url 147 active = listtabs[current_item]['url'] != self.site_url or active 148 if current_item > -1 and current_item < len(listtabs) and active: 149 149 self.mark_active(listtabs[current_item]['id'], 150 150 listtabs[current_item]['url']) 151 152 151 self._activate(res) 153 152 return res … … 165 164 # try to find out appropriate subcategory 166 165 subcat_id = self.cat_prefix + info['id'] + self.cat_sufix 167 i f subcat_id != info['id'] and \168 subcat_id in category.objectIds():166 in_category = subcat_id in category.objectIds() 167 if subcat_id != info['id'] and in_category: 169 168 subcat = category._getOb(subcat_id) 170 169 if IActionCategory.providedBy(subcat): … … 173 172 info['url']) 174 173 175 parent_id = category.getId().replace(self.cat_prefix, 176 '').replace(self.cat_sufix, '') 174 parent_id = category.getId() 175 parent_id = parent_id.replace(self.cat_prefix, '') 176 parent_id = parent_id.replace(self.cat_sufix, '') 177 177 tab = {'id': info['id'], 178 'title': info['title'],179 'url': info['url'],180 'parent': (parent_id, parent_url)}178 'title': info['title'], 179 'url': info['url'], 180 'parent': (parent_id, parent_url)} 181 181 tabslist.append(tab) 182 182 … … 218 218 ec = self.tool._getExprContext(object) 219 219 actions = [ActionInfo(action, ec) for action in category.objectValues() 220 220 if IAction.providedBy(action)] 221 221 222 222 action_infos = [] -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py
r3491 r3514 11 11 [SimpleTerm(value=u'anonymous', title=_(u'Cache only for anonymous')), 12 12 SimpleTerm(value=u'all', title=_(u'Cache for all users')), ] 13 13 ) 14 14 15 15 … … 89 89 description=_(u"Caching of the menu viewlet improves page rendering " 90 90 u"speed."), 91 default=True 92 ) 91 default=True) 93 92 94 93 caching_strategy = schema.Choice( … … 97 96 u"built."), 98 97 default="anonymous", 99 vocabulary=cachings 100 ) 98 vocabulary=cachings) 101 99 102 100 mobile_menu = schema.Bool( 103 101 title=_(u"Display menu as select for small screens"), 104 102 description=_(u"Use select tag to display menu for small screens"), 105 default=False, 106 ) 103 default=False) -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/setuphandlers.py
r3153 r3514 36 36 if qiprod: 37 37 utilities = getattr(qiprod, 'utilities', []) 38 todel = filter(lambda k: not sum(map(39 lambda i: PROJECT_NAME in i, k)), utilities)38 is_project = lambda i: PROJECT_NAME in i 39 todel = filter(lambda k: not sum(map(is_project, k)), utilities) 40 40 for u in todel: 41 41 uidx = utilities.index(u) -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_controlpanel.py
r3153 r3514 21 21 # Check if dropdownmenu is in the control panel 22 22 self.controlpanel = getToolByName(self.portal, "portal_controlpanel") 23 self.failUnless('dropdownmenu' in [a.getAction(self)['id'] 24 for a in self.controlpanel.listActions()]) 23 self.failUnless('dropdownmenu' in [ 24 a.getAction(self)['id'] 25 for a in self.controlpanel.listActions()]) 25 26 26 27 def test_show_icons(self): -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_docs.py
r3153 r3514 28 28 # test_class=TestCase), 29 29 30 30 ]) -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_installation.py
r3153 r3514 25 25 qi = self.portal.portal_quickinstaller 26 26 self.assertTrue(qi.isProductInstalled(PROJECT_NAME), 27 '%s is not installed.' % PROJECT_NAME)27 '%s is not installed.' % PROJECT_NAME) 28 28 29 29 def testInstalledDependencies(self): 30 30 cp = self.portal.portal_controlpanel 31 31 configlets = [ai['id'] for ai in cp.listActionInfos( 32 32 check_permissions=0)] 33 33 self.assertTrue([1 for ai in configlets if ai == "plone.app.registry"], 34 'Not installed required plone.app.registry product.')34 'Not installed required plone.app.registry product.') 35 35 36 36 def testStyles(self): … … 43 43 cp = self.portal.portal_controlpanel 44 44 configlets = [ai['id'] for ai in cp.listActionInfos( 45 45 check_permissions=0)] 46 46 for cid in CONFIGLETS: 47 self.assertTrue([1 for ai in configlets if ai == cid], 47 self.assertTrue([ 48 1 for ai in configlets if ai == cid], 48 49 'No "%s" configlet added to plone control panel' % cid) 49 50 … … 56 57 afield = "show_content_tabs" 57 58 self.assertTrue(registry.records.get(IPREFIX + afield, None), 58 "Not registered '%s' registry interface" % IPREFIX)59 "Not registered '%s' registry interface" % IPREFIX) 59 60 60 61 … … 64 65 qi = self.portal.portal_quickinstaller 65 66 self.assertFalse(qi.isProductInstalled(PROJECT_NAME), 66 '%s not uninstalled.' % PROJECT_NAME)67 '%s not uninstalled.' % PROJECT_NAME) 67 68 68 69 def testStyles(self): … … 75 76 cp = self.portal.portal_controlpanel 76 77 configlets = [ai['id'] for ai in cp.listActionInfos( 77 78 check_permissions=0)] 78 79 for cid in CONFIGLETS: 79 80 self.assertFalse([1 for ai in configlets if ai == cid], 80 '"%s" configlet not uninstalled '\81 'from plone control panel' % cid)81 '"%s" configlet not uninstalled ' 82 'from plone control panel' % cid) 82 83 83 84 def testBrowserLayer(self): 84 85 self.assertFalse(IDropDownMenuLayer in blutils.registered_layers(), 85 "Not unregistered 'IDropDownMenuLayer' browser layer")86 "Not unregistered 'IDropDownMenuLayer' browser layer") 86 87 87 88 def testRegistry(self): … … 89 90 afield = "show_content_tabs" 90 91 self.assertFalse(registry.records.get(IPREFIX + afield, None), 91 "Not unregistered '%s' registry interface" % IPREFIX)92 "Not unregistered '%s' registry interface" % IPREFIX) 92 93 93 94 -
quintagroup.dropdownmenu/trunk/setup.py
r3492 r3514 5 5 6 6 tests_require = ['zope.testing', 7 'collective.testcaselayer']7 'collective.testcaselayer'] 8 8 9 9 setup(name='quintagroup.dropdownmenu', 10 10 version=version, 11 11 description="Multilevel portal dropdown menu for Plone sites.", 12 long_description=open("README.txt").read( ) + "\n" +13 12 long_description=open("README.txt").read( 13 ) + "\n" + open(os.path.join("docs", "HISTORY.txt")).read(), 14 14 classifiers=[ 15 "Framework :: Plone",16 "Programming Language :: Python",17 "License :: OSI Approved :: GNU General Public License (GPL)",18 "Operating System :: OS Independent",19 "Topic :: Software Development :: Libraries :: Python Modules",20 15 "Framework :: Plone", 16 "Programming Language :: Python", 17 "License :: OSI Approved :: GNU General Public License (GPL)", 18 "Operating System :: OS Independent", 19 "Topic :: Software Development :: Libraries :: Python Modules", 20 ], 21 21 keywords='web plone menu', 22 22 author='Quintagroup',
Note: See TracChangeset
for help on using the changeset viewer.