[Erp5-report] r9526 - in /erp5/trunk/bt5/erp5_web: SkinTemplateItem/portal_skins/erp5_web/ bt/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Aug 29 10:54:53 CEST 2006
Author: kevin
Date: Tue Aug 29 10:54:50 2006
New Revision: 9526
URL: http://svn.erp5.org?rev=9526&view=rev
Log:
* WebSection_getDocumentValueList uses Predicate API.
* Sorts result by order Index.
Modified:
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml
erp5/trunk/bt5/erp5_web/bt/change_log
erp5/trunk/bt5/erp5_web/bt/revision
erp5/trunk/bt5/erp5_web/bt/version
Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml?rev=9526&r1=9525&r2=9526&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml Tue Aug 29 10:54:50 2006
@@ -101,36 +101,24 @@
current_node = context\n
while not current_node.getPortalType() in (\'Web Section\', \'Web Site\'):\n
current_node = current_node.aq_parent\n
-\n
# Then find the publication categories referenced by the web section\n
section_categories = current_node.getMembershipCriterionCategoryList()\n
section_base_categories_conjunctive = current_node.getMembershipCriterionBaseCategoryList()\n
section_base_categories_disjunctive = current_node.getMultimembershipCriterionBaseCategoryList()\n
\n
def checkMember(x):\n
- the_categories = x.getCategoriesList()\n
- if the_categories:\n
- for the_category in the_categories:\n
- if the_category in section_categories:\n
- if split(the_category,"/")[0] in section_base_categories_disjunctive:\n
- if x.getValidationState()==\'published\':\n
- return True # one disjunctive category was found\n
- checker=False\n
- for one_category in section_categories:\n
- if split(one_category,"/")[0] in section_base_categories_conjunctive:\n
- if one_category not in the_categories:\n
- return False # one conjunctive category was not found\n
- else:\n
- checker=True\n
- return checker # loop ends, so all conjunctive categories were found - If there were any.\n
- else:\n
- return False\n
-\n
-# get all web pages and check if their publication category is in the category list of the web section\n
-# reference_list = map(lambda x:x.getReference(), context.getSourceValueList(portal_type="Web Page"))\n
-reference_list = map(lambda x:x.getReference(), portal_catalog(portal_type=(\'Web Page\',)))\n
-if reference_list:\n
- li = filter(checkMember, list(context.portal_catalog(portal_type="Web Page")) )\n
+ if x.getValidationState()==\'published\' or x.getValidationState()==\'validated\':\n
+ return current_node.test(x)\n
+\n
+# get all web pages and products and check if they match the predicates of the web section,\n
+# except if there is no membership category in the section.\n
+if not section_categories:\n
+ li = []\n
+else:\n
+ li = list(context.portal_catalog(portal_type="Product"))\n
+ li.extend(list(context.portal_catalog(portal_type="Web Page")))\n
+ li = filter(checkMember, li )\n
+if li:\n
my_list=li\n
else:\n
my_list=[]\n
@@ -139,9 +127,9 @@
if hasattr(current_node,\'getAggregateList\'):\n
aggregate_values = current_node.getAggregateList()\n
aggregate_values = map(context.restrictedTraverse,aggregate_values)\n
- li.extend(aggregate_values) \n
-\n
-# Remove Duplicate entries in my_list\n
+ my_list.extend(aggregate_values) \n
+\n
+# Remove duplicate entries in my_list\n
my_clean_list=[]\n
my_reference_list=[]\n
for my_element in my_list:\n
@@ -149,6 +137,13 @@
my_clean_list.append(my_element)\n
my_reference_list.append(my_element.getReference())\n
\n
+\n
+def compareIndex(c1, c2):\n
+ c1_value = c1.getObject() \n
+ c2_value = c2.getObject() \n
+ return cmp(c1_value.getIntIndex(), c2_value.getIntIndex()) \n
+\n
+my_clean_list.sort(compareIndex)\n
return my_clean_list\n
\n
\n
@@ -258,18 +253,18 @@
<string>section_base_categories_conjunctive</string>
<string>section_base_categories_disjunctive</string>
<string>checkMember</string>
- <string>map</string>
- <string>reference_list</string>
+ <string>li</string>
+ <string>list</string>
<string>filter</string>
- <string>list</string>
- <string>li</string>
<string>my_list</string>
<string>hasattr</string>
<string>aggregate_values</string>
+ <string>map</string>
<string>my_clean_list</string>
<string>my_reference_list</string>
<string>_getiter_</string>
<string>my_element</string>
+ <string>compareIndex</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_web/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/change_log?rev=9526&r1=9525&r2=9526&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/change_log (original)
+++ erp5/trunk/bt5/erp5_web/bt/change_log Tue Aug 29 10:54:50 2006
@@ -1,3 +1,7 @@
+2006-08-29 Stefan
+* WebSection_getDocumentValueList uses Predicate API.
+* Sorts result by order Index.
+
2006-08-29 Kevin
* Clean-up group naming.
Modified: erp5/trunk/bt5/erp5_web/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/revision?rev=9526&r1=9525&r2=9526&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/revision (original)
+++ erp5/trunk/bt5/erp5_web/bt/revision Tue Aug 29 10:54:50 2006
@@ -1,1 +1,1 @@
-260
+263
Modified: erp5/trunk/bt5/erp5_web/bt/version
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/version?rev=9526&r1=9525&r2=9526&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/version (original)
+++ erp5/trunk/bt5/erp5_web/bt/version Tue Aug 29 10:54:50 2006
@@ -1,1 +1,1 @@
-0.3.13
+0.3.14
More information about the Erp5-report
mailing list