Commit 8b7b6315 authored by Nicolas Delaby's avatar Nicolas Delaby

Fix ItemList helper scripts to call getCategoryRelativeUrl on Category...

Fix ItemList helper scripts to call getCategoryRelativeUrl on Category documents and provide expected value.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45624 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 656dd08a
......@@ -57,14 +57,20 @@ by ListField instances.\n
"""\n
from zExceptions import Unauthorized\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
def getResourceItemList():\n
result = [(\'\', \'\')]\n
url_list = context.portal_preferences.getPreferredCampaignResourceList()\n
url_list = portal.portal_preferences.getPreferredCampaignResourceList()\n
for url in url_list:\n
try:\n
resource_value = context.getPortalObject().restrictedTraverse(url)\n
result.append((resource_value.getTranslatedTitle(), resource_value.getRelativeUrl()))\n
resource_value = portal.restrictedTraverse(url, None)\n
if resource_value is not None:\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
result.append((resource_value.getTranslatedTitle(), category_relative_url))\n
except Unauthorized:\n
pass\n
return result\n
......
......@@ -57,15 +57,20 @@ by ListField instances.\n
"""\n
from zExceptions import Unauthorized\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
def getResourceItemList():\n
result = [(\'\', \'\')]\n
url_list = context.portal_preferences.getPreferredEventResourceList()\n
url_list = portal.portal_preferences.getPreferredEventResourceList()\n
for url in url_list:\n
try:\n
resource_value = context.getPortalObject().restrictedTraverse(url, None)\n
resource_value = portal.restrictedTraverse(url, None)\n
if resource_value is not None:\n
result.append((resource_value.getTranslatedTitle(), resource_value.getRelativeUrl()))\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
result.append((resource_value.getTranslatedTitle(), category_relative_url))\n
except Unauthorized:\n
pass\n
return result\n
......@@ -73,7 +78,7 @@ def getResourceItemList():\n
getResourceItemList = CachingMethod(getResourceItemList, \n
id=(script.id, context.Localizer.get_selected_language()), \n
cache_factory=\'erp5_ui_long\')\n
\n
\n
return getResourceItemList()\n
</string> </value>
</item>
......
......@@ -57,14 +57,20 @@ by ListField instances.\n
"""\n
from zExceptions import Unauthorized\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
def getResourceItemList():\n
result = [(\'\', \'\')]\n
url_list = context.portal_preferences.getPreferredMeetingResourceList()\n
url_list = portal.portal_preferences.getPreferredMeetingResourceList()\n
for url in url_list:\n
try:\n
resource_value = context.getPortalObject().restrictedTraverse(url)\n
result.append((resource_value.getTranslatedTitle(), resource_value.getRelativeUrl()))\n
resource_value = portal.restrictedTraverse(url, None)\n
if resource_value is not None:\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
result.append((resource_value.getTranslatedTitle(), category_relative_url))\n
except Unauthorized:\n
pass\n
return result\n
......
......@@ -57,14 +57,20 @@ by ListField instances.\n
"""\n
from zExceptions import Unauthorized\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
def getResourceItemList():\n
result = [(\'\', \'\')]\n
url_list = context.portal_preferences.getPreferredSaleOpportunityResourceList()\n
url_list = portal.portal_preferences.getPreferredSaleOpportunityResourceList()\n
for url in url_list:\n
try:\n
resource_value = context.getPortalObject().restrictedTraverse(url)\n
result.append((resource_value.getTranslatedTitle(), resource_value.getRelativeUrl()))\n
resource_value = portal.restrictedTraverse(url, None)\n
if resource_value is not None:\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
result.append((resource_value.getTranslatedTitle(), category_relative_url))\n
except Unauthorized:\n
pass\n
return result\n
......
......@@ -57,14 +57,20 @@ by ListField instances.\n
"""\n
from zExceptions import Unauthorized\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
def getResourceItemList():\n
result = [(\'\', \'\')]\n
url_list = context.portal_preferences.getPreferredSupportRequestResourceList()\n
url_list = portal.portal_preferences.getPreferredSupportRequestResourceList()\n
for url in url_list:\n
try:\n
resource_value = context.getPortalObject().restrictedTraverse(url)\n
result.append((resource_value.getTranslatedTitle(), resource_value.getRelativeUrl()))\n
resource_value = portal.restrictedTraverse(url, None)\n
if resource_value is not None:\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
result.append((resource_value.getTranslatedTitle(), category_relative_url))\n
except Unauthorized:\n
pass\n
return result\n
......
541
\ No newline at end of file
542
\ 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