[Erp5-report] r27633 - /erp5/trunk/products/ERP5/Document/BusinessPath.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 17 15:06:53 CEST 2009


Author: luke
Date: Wed Jun 17 15:06:49 2009
New Revision: 27633

URL: http://svn.erp5.org?rev=27633&view=rev
Log:
 - simplify more and really respect naming convention (thanks jm again)

Modified:
    erp5/trunk/products/ERP5/Document/BusinessPath.py

Modified: erp5/trunk/products/ERP5/Document/BusinessPath.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessPath.py?rev=27633&r1=27632&r2=27633&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] Wed Jun 17 15:06:49 2009
@@ -144,15 +144,14 @@
       XXX - implementation missing
       TBD - look at CategoryTool._buildFilter for inspiration
     """
-    filtered_category_list = []
-    for local_category in category_list:
-      # basic filtering, dirty way:
-      #  - remove categories, which are not defined in category parameter
-      #  - support base parameter
-      base_category, base_value = local_category.split('/', 1)
-      if base_category == category:
-        filtered_category_list.append(base == 1 and local_category or base_value)
-    return filtered_category_list
+    # basic filtering:
+    #  * remove categories which base name is not category
+    #  * respect base parameter
+    prefix = category + '/'
+    start_index = not base and len(prefix) or 0
+    return [category[start_index:]
+            for category in category_list
+            if category.startswith(prefix)]
 
   # Dynamic context based categories
   def _getDynamicCategoryList(self, context):




More information about the Erp5-report mailing list