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

get things from portal

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44530 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ea618e5
...@@ -51,13 +51,14 @@ ...@@ -51,13 +51,14 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from ZTUtils import make_query\n <value> <string>from ZTUtils import make_query\n
Base_translateString = context.Base_translateString\n portal = context.getPortalObject()\n
checkPerm = context.portal_membership.checkPermission\n Base_translateString = portal.Base_translateString\n
checkPerm = portal.portal_membership.checkPermission\n
\n \n
if jump_from_relative_url is None:\n if jump_from_relative_url is None:\n
relation = context\n relation = context\n
else:\n else:\n
relation = context.getPortalObject().restrictedTraverse(jump_from_relative_url)\n relation = portal.restrictedTraverse(jump_from_relative_url)\n
\n \n
# FIXME: performance problem getting *all* related documents URL is not scalable.\n # FIXME: performance problem getting *all* related documents URL is not scalable.\n
getter_base_name = \'\'.join([x.capitalize() for x in base_category.split(\'_\')])\n getter_base_name = \'\'.join([x.capitalize() for x in base_category.split(\'_\')])\n
...@@ -81,10 +82,10 @@ if len(related_list) == 0:\n ...@@ -81,10 +82,10 @@ if len(related_list) == 0:\n
\n \n
elif len(related_list) == 1:\n elif len(related_list) == 1:\n
relation_found = 1\n relation_found = 1\n
related_object = context.restrictedTraverse(related_list[0], None)\n related_object = portal.restrictedTraverse(related_list[0], None)\n
if related_object is None:\n if related_object is None:\n
# this might be a category\n # this might be a category\n
related_object = context.portal_categories.resolveCategory(\n related_object = portal.portal_categories.resolveCategory(\n
"%s/%s" % (base_category, related_list[0]))\n "%s/%s" % (base_category, related_list[0]))\n
\n \n
if related_object is not None and checkPerm("View", related_object) :\n if related_object is not None and checkPerm("View", related_object) :\n
...@@ -109,10 +110,10 @@ elif len(related_list) == 1:\n ...@@ -109,10 +110,10 @@ elif len(related_list) == 1:\n
else:\n else:\n
# jump to the module if we can guess it\n # jump to the module if we can guess it\n
if len(portal_type) == 1:\n if len(portal_type) == 1:\n
module_id = context.getPortalObject().getDefaultModuleId(portal_type[0], None)\n module_id = portal.getDefaultModuleId(portal_type[0], None)\n
if module_id is not None:\n if module_id is not None:\n
if related:\n if related:\n
return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n return portal.getDefaultModule(portal_type[0]).Base_redirect(\n
\'view\', keep_items={\'default_%s_uid\' % base_category: relation.getUid(),\n \'view\', keep_items={\'default_%s_uid\' % base_category: relation.getUid(),\n
\'ignore_hide_rows\': 1,\n \'ignore_hide_rows\': 1,\n
\'reset\': 1})\n \'reset\': 1})\n
...@@ -127,10 +128,10 @@ else:\n ...@@ -127,10 +128,10 @@ else:\n
# compute the list of objects we are actually authorised to view\n # compute the list of objects we are actually authorised to view\n
related_object_list = []\n related_object_list = []\n
for path in search_method(portal_type=portal_type) :\n for path in search_method(portal_type=portal_type) :\n
obj = context.getPortalObject().restrictedTraverse(path, None)\n obj = portal.restrictedTraverse(path, None)\n
if obj is None:\n if obj is None:\n
# this might be a category\n # this might be a category\n
obj = context.portal_categories.resolveCategory(\n obj = portal.portal_categories.resolveCategory(\n
"%s/%s" % (base_category, path))\n "%s/%s" % (base_category, path))\n
\n \n
if obj is not None and checkPerm("View", obj):\n if obj is not None and checkPerm("View", obj):\n
...@@ -140,10 +141,10 @@ else:\n ...@@ -140,10 +141,10 @@ else:\n
message = Base_translateString("You are not authorised to view any related document.")\n message = Base_translateString("You are not authorised to view any related document.")\n
relation_found = 0\n relation_found = 0\n
else :\n else :\n
request=context.REQUEST\n request=portal.REQUEST\n
selection_uid_list = [x.getUid() for x in related_object_list]\n selection_uid_list = [x.getUid() for x in related_object_list]\n
kw = {\'uid\': selection_uid_list}\n kw = {\'uid\': selection_uid_list}\n
context.portal_selections.setSelectionParamsFor(\n portal.portal_selections.setSelectionParamsFor(\n
\'Base_jumpToRelatedObjectList\', kw)\n \'Base_jumpToRelatedObjectList\', kw)\n
request.set(\'object_uid\', context.getUid())\n request.set(\'object_uid\', context.getUid())\n
request.set(\'uids\', selection_uid_list)\n request.set(\'uids\', selection_uid_list)\n
......
40938 40939
\ No newline at end of file \ 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