From 8255025e4b1a8b7f4fb362d17c427b6e59c0eaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 27 Apr 2009 14:55:13 +0000 Subject: [PATCH] Use getProperty to get the reference, because this document could not have getReference method, and this method could be acquired. Also traverse from portal when getting this document, to prevent having context in the acquisition chain. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26663 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/ERP5Type_asSecurityGroupId.xml | 16 +++++++--------- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_asSecurityGroupId.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_asSecurityGroupId.xml index 75649b72ef..b96cff9cd0 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_asSecurityGroupId.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_asSecurityGroupId.xml @@ -88,6 +88,7 @@ ERP5Type_asSecurityGroupId can also return a list of users whenever a category p to a Person instance. This is useful to implement user based local role assignments\n instead of abstract security based local roles.\n """\n +portal = context.getPortalObject()\n \n # sort the category list lexicographically\n # this prevents us to choose the exact order we want,\n @@ -116,7 +117,7 @@ for base_category in category_order:\n else:\n is_child_category = 0\n category_path = \'%s/%s\' % (base_category, category)\n - category_object = context.portal_categories.getCategoryValue(category_path)\n + category_object = portal.portal_categories.getCategoryValue(category_path)\n if category_object in (None, \'\'):\n raise "SecurityRoleDefinitionError", "Category \'%s\' doesn\'t exist" % (category_path)\n portal_type = category_object.getPortalType()\n @@ -126,12 +127,9 @@ for base_category in category_order:\n if user_name is not None: user_list.append(user_name)\n else:\n if portal_type == \'Category\':\n - category_code = category_object.getCodification() or category_object.getId()\n + category_code = category_object.getCodification() or category_object.getId()\n else:\n - try:\n - category_code = category_object.getReference() or category_object.getId()\n - except AttributeError:\n - category_code = category_object.getId()\n + category_code = category_object.getProperty(\'reference\') or category_object.getId()\n if is_child_category: category_code += \'*\'\n associative_list.append(category_code)\n # Prevent making a cartesian product with an empty set\n @@ -182,9 +180,11 @@ return [\'_\'.join(x) for x in cartesianProduct(list_of_list) if x]\n <tuple> <string>category_order</string> <string>kw</string> + <string>_getattr_</string> + <string>context</string> + <string>portal</string> <string>None</string> <string>list</string> - <string>_getattr_</string> <string>Products.ERP5Type.Utils</string> <string>cartesianProduct</string> <string>list_of_list</string> @@ -198,12 +198,10 @@ return [\'_\'.join(x) for x in cartesianProduct(list_of_list) if x]\n <string>category</string> <string>is_child_category</string> <string>category_path</string> - <string>context</string> <string>category_object</string> <string>portal_type</string> <string>user_name</string> <string>category_code</string> - <string>AttributeError</string> <string>_inplacevar_</string> <string>append</string> <string>$append0</string> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 59be0e4979..a65c2ed38d 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -1170 \ No newline at end of file +1171 \ No newline at end of file -- 2.30.9