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
language = portal.Localizer.get_selected_language()\n
\n
if validation_state is None:\n
validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
\'shared\', \'shared_alive\', \'public\', \'validated\')\n
validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\', \\\n
\'shared\', \'shared_alive\', \'public\', \'validated\')\n
\n
query = current_section.buildSQLQuery(validation_state=validation_state, **kw)\n
return current_section.WebSection_zGetDocumentValueList(language=language,\n
all_languages=all_languages,\n
from_table_list=query[\'from_table_list\'],\n
where_expression=query[\'where_expression\'])\n
all_languages=all_languages,\n
validation_state=validation_state,\n
kw=kw)\n
\n
except Unauthorized:\n
return []\n
</string> </value>
......@@ -195,9 +195,6 @@ except Unauthorized:\n
<string>context</string>
<string>current_section</string>
<string>None</string>
<string>_apply_</string>
<string>query</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -9,6 +9,14 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Use_Database_Methods_Permission</string> </key>
<value>
<list>
<string>Anonymous</string>
</list>
</value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
......@@ -36,14 +44,9 @@
</value>
</item>
<item>
<key> <string>from_table_list</string> </key>
<key> <string>kw</string> </key>
<value>
<dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
<item>
......@@ -53,9 +56,14 @@
</value>
</item>
<item>
<key> <string>where_expression</string> </key>
<key> <string>validation_state</string> </key>
<value>
<dictionary/>
<dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
......@@ -65,10 +73,10 @@
<key> <string>_keys</string> </key>
<value>
<list>
<string>language</string>
<string>all_languages</string>
<string>from_table_list</string>
<string>where_expression</string>
<string>language</string>
<string>all_languages</string>
<string>validation_state</string>
<string>kw</string>
</list>
</value>
</item>
......@@ -93,8 +101,8 @@
<key> <string>arguments_src</string> </key>
<value> <string>language\r\n
all_languages\r\n
from_table_list:list\r\n
where_expression</string> </value>
validation_state:list\r\n
kw</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -132,6 +140,8 @@ where_expression</string> </value>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n
\n
SELECT\n
t.path AS path, t.uid AS uid, t.version AS version\n
FROM\n
......@@ -140,11 +150,15 @@ FROM\n
catalog.uid, catalog.path, catalog.int_index,\n
catalog.reference, my_versioning.language, my_versioning.version\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
WHERE\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
GROUP BY\n
catalog.reference\n
......@@ -157,12 +171,16 @@ FROM\n
) AS t\n
GROUP BY\n
t.reference\n
HAVING\n
MAX(t.version) = t.version\n
HAVING\n
MAX(t.version) = t.version\n
ORDER BY\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>
</item>
......@@ -202,6 +220,8 @@ LIMIT 1000\n
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n
\n
SELECT\n
t.path AS path, t.uid AS uid, t.version AS version\n
FROM\n
......@@ -210,11 +230,15 @@ FROM\n
catalog.uid, catalog.path, catalog.int_index,\n
catalog.reference, my_versioning.language, my_versioning.version\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
WHERE\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
GROUP BY\n
catalog.reference\n
......@@ -227,12 +251,16 @@ FROM\n
) AS t\n
GROUP BY\n
t.reference\n
HAVING\n
MAX(t.version) = t.version\n
HAVING\n
MAX(t.version) = t.version\n
ORDER BY\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>
</item>
......
675
\ No newline at end of file
676
\ 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