Commit 195cbb89 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

improve Base_getRelatedDocumentList so as not to return same documents twice,...

improve Base_getRelatedDocumentList so as not to return same documents twice, and to support other parameters like sorting, still calling portal_catalog twice.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36265 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d1f4b212
...@@ -53,24 +53,18 @@ ...@@ -53,24 +53,18 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 kw.pop(\'follow_up_uid\', None)\n
\n portal_catalog=context.getPortalObject().portal_catalog\n
sub_document_list = context.portal_catalog(\n follow_up_related_document_list = 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_type=portal_type,\n portal_type=portal_type,\n
follow_up_uid=context.getUid(), **kw)\n follow_up_uid=context.getUid(), **kw)\n
\n kw[\'query\'] = ComplexQuery(\n
if not sub_document_list:\n Query(relative_url=\'%s/%%\' % context.getRelativeUrl()),\n
return follow_up_related_document_list\n Query(uid=[x.getUid() for x in follow_up_related_document_list]),\n
\n operator=\'or\')\n
if not follow_up_related_document_list:\n return portal_catalog(portal_type=portal_type, **kw)\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
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -109,16 +103,20 @@ return [doc for doc in follow_up_related_document_list] + [doc for doc in sub_do ...@@ -109,16 +103,20 @@ return [doc for doc in follow_up_related_document_list] + [doc for doc in sub_do
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string>kw</string> <string>kw</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>ComplexQuery</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>None</string> <string>None</string>
<string>_apply_</string>
<string>context</string> <string>context</string>
<string>sub_document_list</string> <string>portal_catalog</string>
<string>_apply_</string>
<string>follow_up_related_document_list</string> <string>follow_up_related_document_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>doc</string> <string>x</string>
<string>_write_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
1609 1610
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment