[Erp5-report] r36265 kazuhiko - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTempl...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 11 12:30:09 CEST 2010
Author: kazuhiko
Date: Fri Jun 11 12:30:05 2010
New Revision: 36265
URL: http://svn.erp5.org?rev=36265&view=rev
Log:
improve Base_getRelatedDocumentList so as not to return same documents twice, and to support other parameters like sorting, still calling portal_catalog twice.
Modified:
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getRelatedDocumentList.xml
erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getRelatedDocumentList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getRelatedDocumentList.xml?rev=36265&r1=36264&r2=36265&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getRelatedDocumentList.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getRelatedDocumentList.xml [utf8] Fri Jun 11 12:30:05 2010
@@ -53,24 +53,18 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>kw.pop(\'relative_url\', None)\n
+ <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
+kw.pop(\'relative_url\', None)\n
kw.pop(\'follow_up_uid\', None)\n
-\n
-sub_document_list = context.portal_catalog(\n
- portal_type=portal_type,\n
- relative_url=\'%s/%%\' % context.getRelativeUrl(), **kw)\n
-\n
-follow_up_related_document_list = context.portal_catalog(\n
+portal_catalog=context.getPortalObject().portal_catalog\n
+follow_up_related_document_list = portal_catalog(\n
portal_type=portal_type,\n
follow_up_uid=context.getUid(), **kw)\n
-\n
-if not sub_document_list:\n
- return follow_up_related_document_list\n
-\n
-if not follow_up_related_document_list:\n
- return sub_document_list\n
-\n
-return [doc for doc in follow_up_related_document_list] + [doc for doc in sub_document_list]\n
+kw[\'query\'] = ComplexQuery(\n
+ Query(relative_url=\'%s/%%\' % context.getRelativeUrl()),\n
+ Query(uid=[x.getUid() for x in follow_up_related_document_list]),\n
+ operator=\'or\')\n
+return portal_catalog(portal_type=portal_type, **kw)\n
</string> </value>
</item>
<item>
@@ -109,16 +103,20 @@ return [doc for doc in follow_up_related
<tuple>
<string>portal_type</string>
<string>kw</string>
+ <string>Products.ZSQLCatalog.SQLCatalog</string>
+ <string>Query</string>
+ <string>ComplexQuery</string>
<string>_getattr_</string>
<string>None</string>
- <string>_apply_</string>
<string>context</string>
- <string>sub_document_list</string>
+ <string>portal_catalog</string>
+ <string>_apply_</string>
<string>follow_up_related_document_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
- <string>doc</string>
+ <string>x</string>
+ <string>_write_</string>
</tuple>
</value>
</item>
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=36265&r1=36264&r2=36265&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Fri Jun 11 12:30:05 2010
@@ -1 +1 @@
-1609
\ No newline at end of file
+1610
\ No newline at end of file
More information about the Erp5-report
mailing list