Commit 05c865c5 authored by Rafael Monnerat's avatar Rafael Monnerat

- The construction of SQL expressions at WebSection_getDocumentValueListBase...

- The construction of SQL expressions at WebSection_getDocumentValueListBase was moved inside the Z SQL Method.
- portal_catalog.getSecurityQuery is be used to add more expressions for
the security.
- It was enabled "Use database method" for Anonymous in Z SQL Method.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22197 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a392266e
...@@ -125,14 +125,14 @@ try:\n ...@@ -125,14 +125,14 @@ try:\n
language = portal.Localizer.get_selected_language()\n language = portal.Localizer.get_selected_language()\n
\n \n
if validation_state is None:\n if validation_state is None:\n
validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\', \\\n
\'shared\', \'shared_alive\', \'public\', \'validated\')\n \'shared\', \'shared_alive\', \'public\', \'validated\')\n
\n \n
query = current_section.buildSQLQuery(validation_state=validation_state, **kw)\n
return current_section.WebSection_zGetDocumentValueList(language=language,\n return current_section.WebSection_zGetDocumentValueList(language=language,\n
all_languages=all_languages,\n all_languages=all_languages,\n
from_table_list=query[\'from_table_list\'],\n validation_state=validation_state,\n
where_expression=query[\'where_expression\'])\n kw=kw)\n
\n
except Unauthorized:\n except Unauthorized:\n
return []\n return []\n
</string> </value> </string> </value>
...@@ -195,9 +195,6 @@ except Unauthorized:\n ...@@ -195,9 +195,6 @@ except Unauthorized:\n
<string>context</string> <string>context</string>
<string>current_section</string> <string>current_section</string>
<string>None</string> <string>None</string>
<string>_apply_</string>
<string>query</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_Use_Database_Methods_Permission</string> </key>
<value>
<list>
<string>Anonymous</string>
</list>
</value>
</item>
<item> <item>
<key> <string>__ac_local_roles__</string> </key> <key> <string>__ac_local_roles__</string> </key>
<value> <value>
...@@ -36,14 +44,9 @@ ...@@ -36,14 +44,9 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>from_table_list</string> </key> <key> <string>kw</string> </key>
<value> <value>
<dictionary> <dictionary/>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value> </value>
</item> </item>
<item> <item>
...@@ -53,9 +56,14 @@ ...@@ -53,9 +56,14 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>where_expression</string> </key> <key> <string>validation_state</string> </key>
<value> <value>
<dictionary/> <dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -65,10 +73,10 @@ ...@@ -65,10 +73,10 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>language</string> <string>language</string>
<string>all_languages</string> <string>all_languages</string>
<string>from_table_list</string> <string>validation_state</string>
<string>where_expression</string> <string>kw</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -93,8 +101,8 @@ ...@@ -93,8 +101,8 @@
<key> <string>arguments_src</string> </key> <key> <string>arguments_src</string> </key>
<value> <string>language\r\n <value> <string>language\r\n
all_languages\r\n all_languages\r\n
from_table_list:list\r\n validation_state:list\r\n
where_expression</string> </value> kw</string> </value>
</item> </item>
<item> <item>
<key> <string>cache_time_</string> </key> <key> <string>cache_time_</string> </key>
...@@ -132,6 +140,8 @@ where_expression</string> </value> ...@@ -132,6 +140,8 @@ where_expression</string> </value>
<key> <string>src</string> </key> <key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n
\n
SELECT\n SELECT\n
t.path AS path, t.uid AS uid, t.version AS version\n t.path AS path, t.uid AS uid, t.version AS version\n
FROM\n FROM\n
...@@ -140,11 +150,15 @@ FROM\n ...@@ -140,11 +150,15 @@ FROM\n
catalog.uid, catalog.path, catalog.int_index,\n catalog.uid, catalog.path, catalog.int_index,\n
catalog.reference, my_versioning.language, my_versioning.version\n catalog.reference, my_versioning.language, my_versioning.version\n
FROM\n FROM\n
<dtml-in from_table_list><dtml-var sequence-item> AS <dtml-var sequence-key>,</dtml-in>\n <dtml-in prefix="table" expr="query[\'from_table_list\']">\n
<dtml-var table_item> AS <dtml-var table_key>,\n
</dtml-in>\n
versioning AS my_versioning\n versioning AS my_versioning\n
WHERE\n WHERE\n
my_versioning.uid = catalog.uid\n my_versioning.uid = catalog.uid\n
AND <dtml-var where_expression>\n <dtml-if "query[\'where_expression\']">\n
AND <dtml-var "query[\'where_expression\']">\n
</dtml-if>\n
<dtml-if all_languages>\n <dtml-if all_languages>\n
GROUP BY\n GROUP BY\n
catalog.reference\n catalog.reference\n
...@@ -157,12 +171,16 @@ FROM\n ...@@ -157,12 +171,16 @@ FROM\n
) AS t\n ) AS t\n
GROUP BY\n GROUP BY\n
t.reference\n t.reference\n
HAVING\n HAVING\n
MAX(t.version) = t.version\n MAX(t.version) = t.version\n
ORDER BY\n ORDER BY\n
t.int_index, t.reference\n t.int_index, t.reference\n
LIMIT 1000\n <dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
<dtml-else>\n
LIMIT 1000\n
</dtml-if>\n
</dtml-let>
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -202,6 +220,8 @@ LIMIT 1000\n ...@@ -202,6 +220,8 @@ LIMIT 1000\n
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n
\n
SELECT\n SELECT\n
t.path AS path, t.uid AS uid, t.version AS version\n t.path AS path, t.uid AS uid, t.version AS version\n
FROM\n FROM\n
...@@ -210,11 +230,15 @@ FROM\n ...@@ -210,11 +230,15 @@ FROM\n
catalog.uid, catalog.path, catalog.int_index,\n catalog.uid, catalog.path, catalog.int_index,\n
catalog.reference, my_versioning.language, my_versioning.version\n catalog.reference, my_versioning.language, my_versioning.version\n
FROM\n FROM\n
<dtml-in from_table_list><dtml-var sequence-item> AS <dtml-var sequence-key>,</dtml-in>\n <dtml-in prefix="table" expr="query[\'from_table_list\']">\n
<dtml-var table_item> AS <dtml-var table_key>,\n
</dtml-in>\n
versioning AS my_versioning\n versioning AS my_versioning\n
WHERE\n WHERE\n
my_versioning.uid = catalog.uid\n my_versioning.uid = catalog.uid\n
AND <dtml-var where_expression>\n <dtml-if "query[\'where_expression\']">\n
AND <dtml-var "query[\'where_expression\']">\n
</dtml-if>\n
<dtml-if all_languages>\n <dtml-if all_languages>\n
GROUP BY\n GROUP BY\n
catalog.reference\n catalog.reference\n
...@@ -227,12 +251,16 @@ FROM\n ...@@ -227,12 +251,16 @@ FROM\n
) AS t\n ) AS t\n
GROUP BY\n GROUP BY\n
t.reference\n t.reference\n
HAVING\n HAVING\n
MAX(t.version) = t.version\n MAX(t.version) = t.version\n
ORDER BY\n ORDER BY\n
t.int_index, t.reference\n t.int_index, t.reference\n
LIMIT 1000\n <dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
<dtml-else>\n
LIMIT 1000\n
</dtml-if>\n
</dtml-let>
]]></string> </value> ]]></string> </value>
</item> </item>
......
675 676
\ 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