From 9fe709d8027dd004c2ca929104cb3aa7d7c58f30 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Tue, 21 Jul 2009 14:16:22 +0000 Subject: [PATCH] Use caching to optimise. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28131 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...CategorizedModuleActionInformationDict.xml | 16 +++---- .../erp5_access_tab/ERP5Site_getTabList.xml | 43 ++++++++++++------- .../bootstrap/erp5_xhtml_style/bt/revision | 2 +- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml index 48621872b1..0fcbd45de6 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml @@ -53,7 +53,9 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>def getModuleActionInformationDict(**kw):\n + <value> <string>from Products.ERP5Type.Cache import CachingMethod\n +\n +def getModuleActionInformationDict(**kw):\n Base_translateString = context.Base_translateString\n result_dict = {}\n \n @@ -201,14 +203,12 @@ \n return result_dict\n \n -from Products.ERP5Type.Cache import CachingMethod\n -from AccessControl import getSecurityManager\n -\n getModuleActionInformationDict = CachingMethod(getModuleActionInformationDict,\n id=\'ERP5Site_getModuleActionInformationDict\',\n cache_factory=\'erp5_ui_long\')\n -return getModuleActionInformationDict(user=getSecurityManager().getUser(),\n - language=context.Localizer.get_selected_language())\n +return getModuleActionInformationDict(\n + user = context.portal_membership.getAuthenticatedMember().getId(), \\\n + language = context.Localizer.get_selected_language())\n </string> </value> </item> <item> @@ -245,11 +245,9 @@ return getModuleActionInformationDict(user=getSecurityManager().getUser(),\n <key> <string>co_varnames</string> </key> <value> <tuple> - <string>getModuleActionInformationDict</string> <string>Products.ERP5Type.Cache</string> <string>CachingMethod</string> - <string>AccessControl</string> - <string>getSecurityManager</string> + <string>getModuleActionInformationDict</string> <string>_getattr_</string> <string>context</string> </tuple> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml index 258d46808d..ff6c817dee 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml @@ -53,72 +53,78 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>def getTabList(**kw):\n - tab_list = []\n + <value> <string>from Products.ERP5Type.Cache import CachingMethod\n \n - status_dict = context.ERP5Site_getConfiguredStatusDict()\n +def getTabList(status_dict, info_dict):\n + tab_list = []\n basic_mode = status_dict[\'basic_mode\']\n dms_mode = status_dict[\'dms_mode\']\n express_mode = status_dict[\'express_mode\']\n -\n - info_dict = context.ERP5Site_getCategorizedModuleActionInformationDict()\n \n if dms_mode:\n tab_list.append({\'id\': \'quick_search_tab\',\n -\t \'icon\': \'tab_icon/access_search.png\',\n + \'icon\': \'tab_icon/access_search.png\',\n \'renderer\': \'ERP5Site_renderQuickSearchDialog\',\n \'title\': \'Quick Search\'})\n \n tab_list.append({\'id\': \'contribution_tab\',\n -\t \'icon\': \'tab_icon/share.png\',\n + \'icon\': \'tab_icon/share.png\',\n \'renderer\': \'ERP5Site_renderContributionDialog\',\n \'title\': \'Contribute\'})\n \n if basic_mode:\n if info_dict.get(\'view\'):\n tab_list.append({\'id\': \'browse_tab\',\n -\t \'icon\': \'tab_icon/list.png\',\n + \'icon\': \'tab_icon/list.png\',\n \'renderer\': \'ERP5Site_renderViewActionList\',\n \'title\': \'Browse\'})\n if info_dict.get(\'add\'):\n tab_list.append({\'id\': \'document_creation_tab\',\n -\t \'icon\': \'tab_icon/filenew.png\',\n + \'icon\': \'tab_icon/filenew.png\',\n \'renderer\': \'ERP5Site_renderDocumentCreationActionList\',\n \'title\': \'New\'})\n \n if info_dict.get(\'search\'):\n tab_list.append({\'id\': \'document_search_tab\',\n -\t \'icon\': \'tab_icon/filefind.png\',\n + \'icon\': \'tab_icon/filefind.png\',\n \'renderer\': \'ERP5Site_renderDocumentSearchActionList\',\n \'title\': \'Dig\'})\n \n if info_dict.get(\'report\'):\n tab_list.append({\'id\': \'report_tab\',\n -\t \'icon\': \'tab_icon/webexport.png\',\n + \'icon\': \'tab_icon/webexport.png\',\n \'renderer\': \'ERP5Site_renderReportActionList\',\n \'title\': \'Reports\'})\n \n if info_dict.get(\'print\'):\n tab_list.append({\'id\': \'printout_tab\',\n -\t \'icon\': \'tab_icon/ps.png\',\n + \'icon\': \'tab_icon/ps.png\',\n \'renderer\': \'ERP5Site_renderPrintActionList\',\n \'title\': \'Printouts\'})\n \n if info_dict.get(\'exchange\'):\n tab_list.append({\'id\': \'exchange_tab\',\n -\t \'icon\': \'tab_icon/imp-exp.png\',\n + \'icon\': \'tab_icon/imp-exp.png\',\n \'renderer\': \'ERP5Site_renderExchangeActionList\',\n \'title\': \'Exchange\'})\n \n if express_mode in (\'support_enabled\', \'advertisement_enabled\'):\n tab_list.append({\'id\': \'express_support_tab\',\n -\t \'icon\': \'tab_icon/support.png\',\n + \'icon\': \'tab_icon/support.png\',\n \'renderer\': \'ERP5Site_renderExpressSupport\',\n \'title\': \'Express Support\'})\n -\n return tab_list\n \n -return getTabList()\n +getTabList = CachingMethod(getTabList, \\\n + id = \'ERP5Site_getTabListInternal\', \\\n + cache_factory = \'erp5_ui_long\')\n +\n +ERP5Site_getConfiguredStatusDict = CachingMethod(context.ERP5Site_getConfiguredStatusDict, \\\n + id = \'ERP5Site_getConfiguredStatusDict\', \\\n + cache_factory = \'erp5_ui_long\')\n +\n +return getTabList(status_dict = ERP5Site_getConfiguredStatusDict(), \\\n + info_dict = context.ERP5Site_getCategorizedModuleActionInformationDict())\n </string> </value> </item> <item> @@ -155,7 +161,12 @@ return getTabList()\n <key> <string>co_varnames</string> </key> <value> <tuple> + <string>Products.ERP5Type.Cache</string> + <string>CachingMethod</string> <string>getTabList</string> + <string>_getattr_</string> + <string>context</string> + <string>ERP5Site_getConfiguredStatusDict</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 44075dbca6..64c6e93534 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -778 \ No newline at end of file +779 \ No newline at end of file -- 2.30.9