[Erp5-report] r28802 - in /erp5/trunk/bt5/erp5_commerce: SkinTemplateItem/portal_skins/erp5...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Sep 3 19:59:17 CEST 2009
Author: lucas
Date: Thu Sep 3 19:59:16 2009
New Revision: 28802
URL: http://svn.erp5.org?rev=28802&view=rev
Log:
- refactored the WebSection_getProductList script
- is better use portal catalog than getObject in WebSite_getProductList
Modified:
erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml
erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml
erp5/trunk/bt5/erp5_commerce/bt/revision
Modified: erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml?rev=28802&r1=28801&r2=28802&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml [utf8] Thu Sep 3 19:59:16 2009
@@ -55,23 +55,11 @@
<key> <string>_body</string> </key>
<value> <string>#TODO : USE CACHE\n
#the goal of this script is to get all the related product of this section\n
-\n
current_web_section = context.REQUEST.get(\'current_web_section\', context)\n
product_list = []\n
-\n
kw[\'portal_type\'] = \'Product\'\n
kw[\'limit\'] = limit\n
-if current_web_section.getMembershipCriterionCategoryList() in (None, []) and current_web_section.getCriterionList() in (None, []):\n
- kw[\'product_line_uid\'] = context.REQUEST.get(\'current_web_site\').getLayoutProperty(\'ecommerce_base_product_line\', \'\')\n
-\n
-product_list = current_web_section.WebSection_getDocumentValueListBase(all_versions=1,\n
- all_languages=1,\n
- **kw)\n
-product_list = [x.getObject() for x in product_list if x.getPortalType() == \'Product\']\n
-\n
-# this step will be remove after have find a good way to improve WebSection_getDocumentValueListBase\n
-# or find another base script for get only product direclty\n
-\n
+product_list = current_web_section.getDocumentValueList(all_versions=1, all_languages=1, **kw)\n
return product_list\n
</string> </value>
</item>
@@ -133,12 +121,7 @@
<string>current_web_section</string>
<string>product_list</string>
<string>_write_</string>
- <string>None</string>
<string>_apply_</string>
- <string>append</string>
- <string>$append0</string>
- <string>_getiter_</string>
- <string>x</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml?rev=28802&r1=28801&r2=28802&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml [utf8] Thu Sep 3 19:59:16 2009
@@ -67,7 +67,7 @@
\n
# Getting all the products from all the visible Web Section.\n
for web_section in web_site.WebSite_getMainSectionList():\n
- product_list.extend([x.getObject() for x in web_section.getDocumentValueList(all_versions=1, all_languages=1, **kw) if x.getObject() not in product_list])\n
+ product_list.extend([x.uid for x in web_section.getDocumentValueList(all_versions=1, all_languages=1, **kw) if x.uid not in product_list])\n
\n
if len(product_list) > limit:\n
random_index_list = []\n
@@ -75,7 +75,9 @@
random_number = randrange(0, len(product_list))\n
if random_number not in random_index_list:\n
random_index_list.append(random_number)\n
- product_list = [product_list[x] for x in random_index_list if product_list[x].getPortalType() == \'Product\']\n
+ product_list = [product_list[x] for x in random_index_list]\n
+\n
+product_list = context.portal_catalog(portal_type=\'Product\', uid=product_list)\n
return product_list\n
Modified: erp5/trunk/bt5/erp5_commerce/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_commerce/bt/revision?rev=28802&r1=28801&r2=28802&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_commerce/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_commerce/bt/revision [utf8] Thu Sep 3 19:59:16 2009
@@ -1,1 +1,1 @@
-188
+190
More information about the Erp5-report
mailing list