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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
bb6f07f8
Commit
bb6f07f8
authored
May 20, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Form: fix action to unproxify fields with DateTime property values
Similar to commit
e1d57590
parent
abfe2f41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+8
-6
No files found.
product/ERP5Form/Form.py
View file @
bb6f07f8
...
...
@@ -1049,6 +1049,9 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
return
proxy_dict_list
_proxy_copy_type_list
=
(
bytes
,
unicode
,
int
,
long
,
float
,
bool
,
list
,
tuple
,
dict
,
DateTime
)
security
.
declareProtected
(
'Change Formulator Forms'
,
'proxifyField'
)
def
proxifyField
(
self
,
field_dict
=
None
,
force_delegate
=
False
,
keep_empty_value
=
False
,
REQUEST
=
None
):
...
...
@@ -1059,14 +1062,13 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
are different. And if you specify keep_empty_value, then empty values
will not be delegated(force_delegate option is high priority).
"""
copy_type_list
=
(
bytes
,
unicode
,
int
,
long
,
float
,
bool
,
list
,
tuple
,
dict
,
DateTime
)
def
copy
(
field
,
value_type
):
new_dict
=
{}
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
value
=
copyMethod
(
value
)
elif
not
(
value
is
None
or
isinstance
(
value
,
copy_type_list
)):
elif
not
(
value
is
None
or
isinstance
(
value
,
self
.
_proxy_copy_type_list
)):
raise
ValueError
(
'%s:%r'
%
(
type
(
value
),
value
))
elif
not
(
keep_empty_value
or
value
):
continue
...
...
@@ -1186,9 +1188,9 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
value
=
copyMethod
(
value
)
elif
value
is
not
None
and
not
isinstance
(
value
,
(
str
,
unicode
,
int
,
long
,
float
,
bool
,
list
,
tuple
,
dic
t
)):
raise
ValueError
,
'%s:%s'
%
(
type
(
value
),
repr
(
value
))
elif
not
(
value
is
None
or
isinstance
(
value
,
self
.
_proxy_copy_type_lis
t
)):
raise
ValueError
(
'%s:%r'
%
(
type
(
value
),
value
))
new_dict
[
key
]
=
value
return
new_dict
...
...
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