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
d42e8520
Commit
d42e8520
authored
Oct 15, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Jan 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: make erp5_hal_json_style compatible with Python 3.
parent
29d6c7b7
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
96 deletions
+107
-96
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+3
-2
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
...em/portal_skins/erp5_hal_json_style/Base_renderMessage.py
+2
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+35
-33
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
...portal_skins/erp5_hal_json_style/Workflow_statusModify.py
+2
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+65
-59
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
d42e8520
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
from
erp5.component.module.Log
import
log
,
WARNING
from
erp5.component.module.Log
import
log
,
WARNING
from
Products.Formulator.Errors
import
FormValidationError
from
Products.Formulator.Errors
import
FormValidationError
import
json
import
json
import
six
# http://stackoverflow.com/a/13105359
# http://stackoverflow.com/a/13105359
def
byteify
(
value
):
def
byteify
(
value
):
if
isinstance
(
value
,
dict
):
if
isinstance
(
value
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
value
.
iteritems
(
)}
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
six
.
iteritems
(
value
)}
elif
isinstance
(
value
,
list
):
elif
isinstance
(
value
,
list
):
return
[
byteify
(
element
)
for
element
in
value
]
return
[
byteify
(
element
)
for
element
in
value
]
elif
isinstance
(
value
,
tuple
):
elif
isinstance
(
value
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
value
)
return
tuple
(
byteify
(
element
)
for
element
in
value
)
elif
isinstance
(
value
,
unicod
e
):
elif
six
.
PY2
and
isinstance
(
value
,
six
.
text_typ
e
):
return
value
.
encode
(
'utf-8'
)
return
value
.
encode
(
'utf-8'
)
else
:
else
:
return
value
return
value
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
View file @
d42e8520
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
"""
"""
import
json
import
json
from
erp5.component.module.Log
import
WARNING
,
ERROR
from
erp5.component.module.Log
import
WARNING
,
ERROR
import
six
if
isinstance
(
level
,
(
str
,
unicod
e
)):
if
isinstance
(
level
,
(
str
,
six
.
text_typ
e
)):
if
level
.
lower
()
==
"error"
:
if
level
.
lower
()
==
"error"
:
response_code
=
500
response_code
=
500
elif
level
.
lower
().
startswith
(
"warn"
):
elif
level
.
lower
().
startswith
(
"warn"
):
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
d42e8520
This diff is collapsed.
Click to expand it.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
View file @
d42e8520
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
erp5.component.module.Log
import
WARNING
from
erp5.component.module.Log
import
WARNING
import
six
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
REQUEST
or
context
.
REQUEST
request
=
REQUEST
or
context
.
REQUEST
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
if
listbox
is
not
None
:
if
listbox
is
not
None
:
listbox_line_list
=
[]
listbox_line_list
=
[]
for
key
,
value
in
sorted
(
listbox
.
iteritems
(
)):
for
key
,
value
in
sorted
(
six
.
iteritems
(
listbox
)):
value
[
'listbox_key'
]
=
key
value
[
'listbox_key'
]
=
key
listbox_line_list
.
append
(
value
)
listbox_line_list
.
append
(
value
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
d42e8520
This diff is collapsed.
Click to expand it.
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