Commit 1a45d21c authored by Jérome Perrin's avatar Jérome Perrin

That script was responsible for setting [None] as site list on ingested...

That script was responsible for setting [None] as site list on ingested documents. Refactor it a little to do costly things inside the cached method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44792 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e99b0b2
...@@ -56,29 +56,27 @@ ...@@ -56,29 +56,27 @@
\n \n
from Products.ERP5Type.Cache import CachingMethod\n from Products.ERP5Type.Cache import CachingMethod\n
\n \n
portal = context.getPortalObject()\n def getPersonCareerDict(user_name):\n
result = {\'group_list\': [],\n portal = context.getPortalObject()\n
result = {\'group_list\': [],\n
\'site_list\': [],\n \'site_list\': [],\n
}\n }\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name)\n person = portal.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name)\n
if person is None:\n if person is None:\n
return result\n return result\n
\n \n
def getPersonCareerDict(username):\n
person = portal.restrictedTraverse(person_relative_url)\n
group = person.getGroup()\n group = person.getGroup()\n
organisation = person.getSubordinationValue()\n organisation = person.getSubordinationValue()\n
if group is not None:\n if group is not None:\n
result[\'group_list\']=[group]\n result[\'group_list\'] = [group]\n
if organisation is not None:\n if organisation is not None:\n
result[\'site_list\']=[organisation.getSite()]\n result[\'site_list\'] = organisation.getSiteList()\n
return result\n return result\n
\n \n
person_relative_url = person.getRelativeUrl()\n
getPersonCareerDict = CachingMethod(getPersonCareerDict,\n getPersonCareerDict = CachingMethod(getPersonCareerDict,\n
("ERP5Site_getPersonCareerDict",),\n ("ERP5Site_getPersonCareerDict",),\n
cache_factory=\'erp5_ui_short\')\n cache_factory=\'erp5_content_short\')\n
return getPersonCareerDict(person_relative_url)\n return getPersonCareerDict(user_name)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
965 966
\ 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