Commit 4901a5e5 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Initial import.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1391 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 47aac7cd
No related merge requests found
## Script (Python) "ERP5Site_getModuleItemList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
from Products.ERP5Type.Cache import CachingMethod
try:
user = context.portal_membership.getAuthenticatedMember().getUserName()
except:
user = None
def getModuleItemList(user=None):
translate = context.translation_service.translate
item_list = []
for module in context.getPortalObject().objectValues('ERP5 Folder'):
url = module.absolute_url()
label = module.getTitle() or module.getId()
label = translate('ui', label)
item_list.append((url, label))
def compareModules(a, b): return cmp(a[1], b[1])
item_list.sort(compareModules)
return item_list
getModuleItemList = CachingMethod(getModuleItemList, id='ERP5Site_getModuleItemList')
return getModuleItemList(user=user)
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