Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
erp5
Commits
1e917826
Commit
1e917826
authored
Oct 05, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: Support group_by_list and order_by_list in WebSection_getDocumentValueList.
parent
620f865a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueListBase.xml
...al_skins/erp5_web/WebSection_getDocumentValueListBase.xml
+14
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
...ortal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
+1
-1
No files found.
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueListBase.xml
View file @
1e917826
...
...
@@ -104,6 +104,7 @@ from zExceptions import Unauthorized\n
\n
try:\n
portal = container.getPortalObject()\n
kw = portal.portal_catalog.getSQLCatalog().getCannonicalArgumentDict(kw)\n
\n
# First find the Web Section or Web Site we belong to\n
current_section = context.getWebSectionValue()\n
...
...
@@ -125,9 +126,9 @@ try:\n
\'public\', \'validated\')\n
kw[\'validation_state\'] = validation_state\n
\n
if \'
sort_on
\' not in kw:\n
if \'
order_by_list
\' not in kw:\n
# XXX Do not sort by default, as it increases query time\n
kw[\'
sort_on
\'] = [(\'int_index\', \'DESC\'), (\'reference\', \'DESC\')]\n
kw[\'
order_by_list
\'] = [(\'int_index\', \'DESC\'), (\'reference\', \'DESC\')]\n
\n
if effective_date is None:\n
if now is None:\n
...
...
@@ -140,11 +141,19 @@ try:\n
kw[\'effective_date\'] = effective_date\n
\n
if not all_versions:\n
group_by_list =
lis
t(kw.get(\'group_by_list\', []))\n
group_by_list =
se
t(kw.get(\'group_by_list\', []))\n
if all_languages:\n
kw[\'group_by_list\'] =
group_by_list + [\'reference\', \'language\']
\n
kw[\'group_by_list\'] =
list(group_by_list.union([\'reference\', \'language\']))
\n
else:\n
kw[\'group_by_list\'] = group_by_list + [\'reference\',]\n
kw[\'group_by_list\'] = list(group_by_list.union([\'reference\']))\n
\n
# Extend select_dict by order_by_list and group_by_list columns.\n
extra_column_list = filter(\n
lambda x: not x.endswith(\'__score__\'),\n
{i[0] for i in kw.get(\'order_by_list\', [])}.union(\n
set(kw.get(\'group_by_list\', []))))\n
kw.setdefault(\'select_dict\', {}).update({\n
\'%s__ext__\' % x.replace(\'.\', \'_\'): x for x in extra_column_list})\n
return current_section.WebSection_zGetDocumentValueList(language=language,\n
all_languages=all_languages,\n
src__=src__,\n
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
View file @
1e917826
...
...
@@ -64,7 +64,7 @@ kw</string> </value>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw),
auto_extend_select_list=True,
**kw)"\n
<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), **kw)"\n
selection_domain="kw.get(\'selection_domain\', None)"\n
selection_report="kw.get(\'selection_report\', None)">
\n
\n
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment