[Erp5-report] r13724 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 27 17:44:31 CEST 2007


Author: jerome
Date: Tue Mar 27 17:44:30 2007
New Revision: 13724

URL: http://svn.erp5.org?rev=13724&view=rev
Log:
use fallback categories instead of hardcoding destination_region, source_region
etc.


Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Predicate_getMembershipCriterionCategoryList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Predicate_getMembershipCriterionCategoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Predicate_getMembershipCriterionCategoryList.xml?rev=13724&r1=13723&r2=13724&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Predicate_getMembershipCriterionCategoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Predicate_getMembershipCriterionCategoryList.xml Tue Mar 27 17:44:30 2007
@@ -78,13 +78,19 @@
 \n
 category_list = []\n
 \n
+ctool = context.portal_categories\n
 for item in mixed_list:\n
-  if item in (\'destination_region\', \'source_region\'):\n
-    category = \'region\' # This must be made more generic\n
-    category_list += [(x[0], \'%s/%s\' % (item, x[1])) for x in \n
-                      context.portal_categories[category].getCategoryChildCompactLogicalPathItemList(base=1)]\n
-  else:\n
-    category_list += context.portal_categories[item].getCategoryChildCompactLogicalPathItemList(base=1)\n
+  base_category = ctool[item]\n
+  item_list = base_category.getCategoryChildCompactLogicalPathItemList(base=1)\n
+  if item_list == [[\'\', \'\']]:\n
+    for fallback_category in base_category.getFallbackBaseCategoryList():\n
+      fallback_category = ctool.restrictedTraverse(fallback_category, None)\n
+      if fallback_category:\n
+        item_list = [(\'%s/%s\' % (item, x[0]), \'%s/%s\' % (item, x[1])) for x in\n
+                     fallback_category.getCategoryChildCompactLogicalPathItemList(base=1)]\n
+        break\n
+\n
+  category_list.extend(item_list)\n
 \n
 return category_list\n
 </string> </value>
@@ -137,10 +143,14 @@
                             <string>_getiter_</string>
                             <string>item</string>
                             <string>category_list</string>
-                            <string>category</string>
+                            <string>ctool</string>
+                            <string>_getitem_</string>
+                            <string>base_category</string>
+                            <string>item_list</string>
+                            <string>fallback_category</string>
+                            <string>None</string>
                             <string>append</string>
                             <string>$append0</string>
-                            <string>_getitem_</string>
                             <string>x</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=13724&r1=13723&r2=13724&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Tue Mar 27 17:44:30 2007
@@ -1,1 +1,1 @@
-285
+282




More information about the Erp5-report mailing list