From 13d1c69ab3cb403b5633d9b9fa74614d79372657 Mon Sep 17 00:00:00 2001
From: Gabriel Monnerat <gabriel@tiolive.com>
Date: Mon, 17 Jan 2011 09:06:28 +0000
Subject: [PATCH] 2010-01-17 gabriel * Add CachingMethod to extract all
 subjects from all objects in Web Page Module

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42368 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../WebPageModule_generateDomain.xml                   | 10 ++++++++--
 bt5/erp5_web_ung_theme/bt/change_log                   |  3 +++
 bt5/erp5_web_ung_theme/bt/revision                     |  2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml
index 1d2c4a956b..0ecea4e34d 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml
@@ -56,6 +56,8 @@
   This script generates a sections list to filter the document on UNG Docs.\n
 """\n
 \n
+from Products.ERP5Type.Cache import CachingMethod\n
+\n
 def getAvailableSubjectList(subject_list=()):\n
   """\n
     Returns the list of available subjects for all documents\n
@@ -101,9 +103,13 @@ domain_list = []\n
 if depth > 1:\n
   return domain_list\n
 \n
-validation_state_list = [\'draft\', \'published\', \'shared\']\n
+getAvailableSubjectListCached = CachingMethod(getAvailableSubjectList, \n
+                                              id=\'%s_%s\' % (script.id, \'subject_list_cached\'),\n
+                                              cache_factory=\'erp5_ui_short\')\n
+\n
+subject_list = getAvailableSubjectListCached()\n
 \n
-for subject in getAvailableSubjectList():\n
+for subject in subject_list:\n
   appendTempDomain("subject_" + subject,\n
                    subject.capitalize(),\n
                    dict(subject=subject),\n
diff --git a/bt5/erp5_web_ung_theme/bt/change_log b/bt5/erp5_web_ung_theme/bt/change_log
index 160bf6a44f..9ade169ead 100644
--- a/bt5/erp5_web_ung_theme/bt/change_log
+++ b/bt5/erp5_web_ung_theme/bt/change_log
@@ -1,3 +1,6 @@
+2010-01-17 gabriel
+* Add CachingMethod to extract all subjects from all objects in Web Page Module
+
 2010-01-10 gabriel
 * Add gadget view on UNG template and added script to add a gadget
 
diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision
index 2efea5198b..a3090d211b 100644
--- a/bt5/erp5_web_ung_theme/bt/revision
+++ b/bt5/erp5_web_ung_theme/bt/revision
@@ -1 +1 @@
-167
\ No newline at end of file
+168
\ No newline at end of file
-- 
2.30.9