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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
d8093a7a
Commit
d8093a7a
authored
Aug 23, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: set the locked status only at the end
Prevent potential errors to be returned with 201 status
parent
b9c169f0
Pipeline
#35422
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
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
+12
-12
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
View file @
d8093a7a
...
...
@@ -16,18 +16,6 @@ request_form = context.ERP5Site_filterParameterList(request_form)
request_form
.
update
(
keep_items
)
# XXX Allow CORS
response
=
context
.
REQUEST
.
RESPONSE
context
.
Base_prepareCorsResponse
(
RESPONSE
=
response
)
# http://en.wikipedia.org/wiki/Post/Redirect/Get
response
.
setStatus
(
201
,
lock
=
True
)
response
.
setHeader
(
"X-Location"
,
"urn:jio:get:%s"
%
context
.
getRelativeUrl
())
# be explicit with the reponse content type because in case of reports - they
# can be in text/plain, application/pdf ... so the RJS form needs to know what
# is going exactly on. ERP5Document_getHateoas returns application/hal+json
# 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"
...
...
@@ -70,8 +58,20 @@ if (form_id not in [None, 'Base_viewFakePythonScriptActionForm', 'Base_viewFakeJ
)
}
# XXX Allow CORS
response
=
context
.
REQUEST
.
RESPONSE
context
.
Base_prepareCorsResponse
(
RESPONSE
=
response
)
response
.
setHeader
(
"X-Location"
,
"urn:jio:get:%s"
%
context
.
getRelativeUrl
())
# be explicit with the reponse content type because in case of reports - they
# can be in text/plain, application/pdf ... so the RJS form needs to know what
# is going exactly on. ERP5Document_getHateoas returns application/hal+json
# therefor we don't need to be afraid of clashes
response
.
setHeader
(
"Content-type"
,
"application/json; charset=utf-8"
)
result
=
json
.
dumps
(
result_dict
,
indent
=
2
)
# http://en.wikipedia.org/wiki/Post/Redirect/Get
response
.
setStatus
(
201
,
lock
=
True
)
if
abort_transaction
:
response
.
setBody
(
result
,
lock
=
True
)
raise
Redirect
(
''
)
...
...
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