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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
b43bed09
Commit
b43bed09
authored
May 14, 2018
by
Tomáš Peterka
Committed by
Romain Courteaud
Jun 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Support portal_status_level on redirect
parent
a5c5cf58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
...ateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
+11
-6
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
View file @
b43bed09
"""
This script factorises code required to redirect to the appropriate
page from a script. It should probably be extended, reviewed and documented
so that less code is copied and pasted in dialog scripts.
"""UI Script to redirect the user to `context` with optional custom view `form_id`.
TODO: improve API and extensively document. ERP5Site_redirect may
be redundant.
:param keep_items: is used mainly to pass "portal_status_message" to be showed to the user
the new UI supports "portal_status_level" with values "success" or "error"
"""
from
ZTUtils
import
make_query
import
json
...
...
@@ -40,8 +37,16 @@ response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl())
# therefor we don't need to be afraid of clashes
response
.
setHeader
(
"Content-type"
,
"application/json; charset=utf-8"
)
portal_status_level
=
keep_items
.
pop
(
"portal_status_level"
,
"success"
)
if
portal_status_level
in
(
"warning"
,
"error"
,
"fatal"
):
portal_status_level
=
"error"
if
portal_status_level
in
(
"info"
,
"debug"
,
"success"
):
portal_status_level
=
"success"
result_dict
=
{
'portal_status_message'
:
"%s"
%
keep_items
.
pop
(
"portal_status_message"
,
""
),
'portal_status_level'
:
"%s"
%
portal_status_level
,
'_links'
:
{
"self"
:
{
# XXX Include query parameters
...
...
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