Commit 9011ec4c authored by Lucas Carvalho's avatar Lucas Carvalho

- Use an existing script to get Person Value and cache will be used.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29053 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 39220999
...@@ -53,30 +53,17 @@ ...@@ -53,30 +53,17 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string># based on current Authenticated Member this script must return\n
# the Person object\n
# XXX: it must be cached.\n
from Products.ERP5Type.Cache import CachingMethod\n from Products.ERP5Type.Cache import CachingMethod\n
\n \n
user_id = context.portal_membership.getAuthenticatedMember().getId()\n user_id = context.portal_membership.getAuthenticatedMember().getId()\n
if context.portal_membership.isAnonymousUser():\n if context.portal_membership.isAnonymousUser():\n
return None\n return None\n
\n \n
def getFoundUserRelativeUrl(user_id):\n return context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_id)\n
""" Find Person object by login name. """\n </string> </value>
user_list = context.person_module.portal_catalog(reference=user_id, \\\n
portal_type="Person")\n
if len(user_list)>0:\n
user_object = user_list[0].getObject()\n
return user_object.getRelativeUrl()\n
\n
#user_relative_url = CachingMethod(getFoundUserRelativeUrl, script.id)(user_id)\n
user_relative_url = getFoundUserRelativeUrl(user_id)\n
\n
if user_relative_url is not None:\n
return context.getPortalObject().restrictedTraverse(user_relative_url)\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -127,8 +114,6 @@ if user_relative_url is not None:\n ...@@ -127,8 +114,6 @@ if user_relative_url is not None:\n
<string>context</string> <string>context</string>
<string>user_id</string> <string>user_id</string>
<string>None</string> <string>None</string>
<string>getFoundUserRelativeUrl</string>
<string>user_relative_url</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>context.REQUEST.set(\'editable_mode\', 1)\n <value> <string>context.REQUEST.set(\'editable_mode\', 1)\n
return context.getWebSectionValue().restrictedTraverse(\'person_module/1\').Person_viewAsWeb(context.REQUEST)\n person_object = context.getWebSiteValue().SaleOrder_getShoppingCartCustomer()\n
return context.getWebSectionValue().restrictedTraverse(person_object.getRelativeUrl()).Person_viewAsWeb(context.REQUEST)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -93,6 +94,7 @@ return context.getWebSectionValue().restrictedTraverse(\'person_module/1\').Pers ...@@ -93,6 +94,7 @@ return context.getWebSectionValue().restrictedTraverse(\'person_module/1\').Pers
<tuple> <tuple>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>person_object</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
219 221
\ 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