Commit 9eb49592 authored by Lucas Carvalho's avatar Lucas Carvalho

- Added Caching Method.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29055 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d9ab5bda
......@@ -55,14 +55,18 @@
<key> <string>_body</string> </key>
<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
\n
user_id = context.portal_membership.getAuthenticatedMember().getId()\n
if context.portal_membership.isAnonymousUser():\n
return None\n
\n
return context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_id)\n
def getAuthenticatedMemberPersonValue(user_id):\n
return context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_id)\n
\n
getAuthenticatedMemberPersonValue = CachingMethod(getAuthenticatedMemberPersonValue,\n
id=script.getId())\n
return getAuthenticatedMemberPersonValue(user_id)\n
</string> </value>
</item>
<item>
......@@ -114,6 +118,8 @@ return context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue(user
<string>context</string>
<string>user_id</string>
<string>None</string>
<string>getAuthenticatedMemberPersonValue</string>
<string>script</string>
</tuple>
</value>
</item>
......
221
\ No newline at end of file
223
\ 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