Commit b0fda33a authored by Jérome Perrin's avatar Jérome Perrin

remove try: except: in ERP5Site_getModuleItemList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10352 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e8820662
......@@ -68,32 +68,21 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Cache import CachingMethod, clearCache\n
from ZODB.POSException import ConflictError\n
\n
user = context.portal_membership.getAuthenticatedMember()\n
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
user = context.portal_membership.getAuthenticatedMember().getUserName()\n
portal = context.getPortalObject()\n
\n
def getModuleItemList(user=None, portal_path=None):\n
gettext = context.Localizer.erp5_ui.gettext\n
item_list = []\n
try :\n
for module_id in portal.objectIds(\'ERP5 Folder\'):\n
try:\n
module = portal[module_id]\n
if user.has_permission(\'View\', module):\n
url = module.getPath()\n
label = module.getTitleOrId()\n
label = gettext(label)\n
item_list.append((label, url))\n
except ConflictError : raise\n
except: pass\n
except ConflictError : raise\n
except: pass\n
for module_id in portal.objectIds(spec=(\'ERP5 Folder\',)):\n
module = portal.restrictedTraverse(module_id, None)\n
if module is not None:\n
if portal.portal_membership.checkPermission(\'View\', module):\n
item_list.append((gettext(module.getTitleOrId()), module.getPath()))\n
\n
def compareModules(a, b): return cmp(a[0], b[0])\n
item_list.sort(compareModules)\n
item_list.sort(lambda a, b:cmp(a[0], b[0]))\n
return item_list\n
\n
getModuleItemList = CachingMethod(getModuleItemList, id=\'ERP5Site_getModuleItemList\')\n
......@@ -113,6 +102,12 @@ return getModuleItemList(user=user, portal_path=portal_path)\n
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
......@@ -143,9 +138,6 @@ return getModuleItemList(user=user, portal_path=portal_path)\n
<tuple>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>clearCache</string>
<string>ZODB.POSException</string>
<string>ConflictError</string>
<string>_getattr_</string>
<string>context</string>
<string>user</string>
......
80
\ No newline at end of file
81
\ No newline at end of file
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