Commit 857826de authored by Romain Courteaud's avatar Romain Courteaud

When searching subobject, be sure that context is a parent container.

Unify both query to prevent retrieving the same object twice.

Thanks to Łukasz Nowak for his contribution.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24744 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2964f6e
...@@ -53,20 +53,18 @@ ...@@ -53,20 +53,18 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
portal_catalog = portal.portal_catalog\n
path = "%" + "%s" % (context.getRelativeUrl()) + "%"\n
\n
\n \n
# Get The documents in all storage structure. ie.: This scripts get all Files and Images\n # Get The documents in all storage structure. ie.: This scripts get all Files and Images\n
# distributed in many Project Lines in one Project.\n # distributed in many Project Lines in one Project.\n
query = ComplexQuery(\n
Query(relative_url=\'%s/%%\' % context.getRelativeUrl()),\n
Query(follow_up_uid=context.getUid()),\n
operator=\'OR\')\n
\n \n
document_in_entity_list = portal_catalog(path=path , portal_type=portal_type)\n return context.portal_catalog(\n
\n portal_type=portal_type,\n
follow_up_document_list = portal_catalog(portal_type=portal_type,\n query=query)\n
follow_up_uid=context.getUid())\n
\n
return list(document_in_entity_list)+list(follow_up_document_list)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -105,14 +103,12 @@ return list(document_in_entity_list)+list(follow_up_document_list)\n ...@@ -105,14 +103,12 @@ return list(document_in_entity_list)+list(follow_up_document_list)\n
<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>context</string> <string>context</string>
<string>portal</string> <string>query</string>
<string>portal_catalog</string>
<string>path</string>
<string>document_in_entity_list</string>
<string>follow_up_document_list</string>
<string>list</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
1030 1031
\ 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