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
Binh
erp5
Commits
da1623d2
Commit
da1623d2
authored
May 04, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
May 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Convert encoded JSON from unicode to UTF8 str
parent
5e1811b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+14
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
da1623d2
...
...
@@ -16,6 +16,19 @@ from Products.Formulator.Errors import FormValidationError, ValidationError
from
ZTUtils
import
make_query
import
json
# http://stackoverflow.com/a/13105359
def
byteify
(
value
):
if
isinstance
(
value
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
value
.
iteritems
()}
elif
isinstance
(
value
,
list
):
return
[
byteify
(
element
)
for
element
in
value
]
elif
isinstance
(
value
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
value
)
elif
isinstance
(
value
,
unicode
):
return
value
.
encode
(
'utf-8'
)
else
:
return
value
def
isFieldType
(
field
,
type_name
):
if
field
.
meta_type
==
'ProxyField'
:
field
=
field
.
getRecursiveTemplateField
()
...
...
@@ -84,7 +97,7 @@ if dialog_method == 'Base_createRelation':
form
=
getattr
(
context
,
dialog_id
)
form_data
=
None
extra_param
=
json
.
loads
(
extra_param_json
or
"{}"
)
extra_param
=
byteify
(
json
.
loads
(
extra_param_json
or
"{}"
)
)
# form can be a python script that returns the form
if
not
hasattr
(
form
,
'validate_all_to_request'
):
...
...
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