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
0cb802dc
Commit
0cb802dc
authored
May 25, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style] Propagate default parameters for all non standard search methods.
parent
7ce5c139
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
...rp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
+2
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+12
-6
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
View file @
0cb802dc
...
...
@@ -70,13 +70,14 @@ return context.ERP5Document_getHateoas(\n
form=form,\n
relative_url=relative_url,\n
list_method=list_method,\n
default_param_json=default_param_json,\n
restricted=1\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, list_method=None
</string>
</value>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, list_method=None
, default_param_json=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
0cb802dc
...
...
@@ -60,6 +60,7 @@
from ZTUtils import make_query\n
import json\n
from base64 import urlsafe_b64encode, urlsafe_b64decode\n
from DateTime import DateTime\n
if REQUEST is None:\n
REQUEST = context.REQUEST\n
...
...
@@ -78,6 +79,7 @@ url_template_dict = {\n
"custom_search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
"&relative_url=%(relative_url)s" \\\n
"&list_method=%(list_method)s" \\\n
"&default_param_json=%(default_param_json)s" \\\n
"{&query,select_list*,limit*}",\n
"new_content_action": "%(root_url)s/%(script_id)s?mode=newContent",\n
# XXX View is set by default to empty\n
...
...
@@ -277,16 +279,17 @@ def renderField(field, meta_type=None):\n
\n
if (list_method_name == "portal_catalog"):\n
pass\n
elif (list_method_name
in ("searchFolder", "objectValues")
):\n
elif (list_method_name
== "searchFolder"
):\n
list_method_query_dict["parent_uid"] = traversed_document.getUid()\n
else:\n
list_method_custom = url_template_dict["custom_search_template"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id,\n
"relative_url": traversed_document.getRelativeUrl().replace("/", "%2F"),\n
"list_method": list_method_name\n
"list_method": list_method_name,\n
"default_param_json": urlsafe_b64encode(json.dumps(list_method_query_dict))\n
}\n
\n
list_method_query_dict = {}
\n
\n
# row_list = list_method(limit=lines, portal_type=portal_types,\n
# **default_params)\n
...
...
@@ -797,14 +800,17 @@ elif mode == \'search\':\n
# length = len(\'/%s/\' % portal.getId())\n
# # context.log(portal.portal_catalog(full_text=query, limit=limit, src__=1))\n
# context.log(query)\n
catalog_kw = {}\n
if (default_param_json is not None):\n
catalog_kw = json.loads(urlsafe_b64decode(default_param_json))\n
if (list_method is None):\n
callable_list_method = portal.portal_catalog\n
else:\n
callable_list_method = getattr(traversed_document, list_method)\n
if query:\n
sql_list = callable_list_method(full_text=query, limit=limit)\n
sql_list = callable_list_method(full_text=query, limit=limit
, **catalog_kw
)\n
else:\n
sql_list = callable_list_method(limit=limit)\n
sql_list = callable_list_method(limit=limit
, **catalog_kw
)\n
\n
result_list = []\n
\n
...
...
@@ -908,7 +914,7 @@ return json.dumps(result_dict, indent=2)\n
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, restricted=0, list_method=None
</string>
</value>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, restricted=0, list_method=None
, default_param_json=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
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