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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
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):
...
@@ -1049,6 +1049,9 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
return
proxy_dict_list
return
proxy_dict_list
_proxy_copy_type_list
=
(
bytes
,
unicode
,
int
,
long
,
float
,
bool
,
list
,
tuple
,
dict
,
DateTime
)
security
.
declareProtected
(
'Change Formulator Forms'
,
'proxifyField'
)
security
.
declareProtected
(
'Change Formulator Forms'
,
'proxifyField'
)
def
proxifyField
(
self
,
field_dict
=
None
,
force_delegate
=
False
,
def
proxifyField
(
self
,
field_dict
=
None
,
force_delegate
=
False
,
keep_empty_value
=
False
,
REQUEST
=
None
):
keep_empty_value
=
False
,
REQUEST
=
None
):
...
@@ -1059,14 +1062,13 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1059,14 +1062,13 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
are different. And if you specify keep_empty_value, then empty values
are different. And if you specify keep_empty_value, then empty values
will not be delegated(force_delegate option is high priority).
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
):
def
copy
(
field
,
value_type
):
new_dict
=
{}
new_dict
=
{}
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
value
=
copyMethod
(
value
)
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
))
raise
ValueError
(
'%s:%r'
%
(
type
(
value
),
value
))
elif
not
(
keep_empty_value
or
value
):
elif
not
(
keep_empty_value
or
value
):
continue
continue
...
@@ -1186,9 +1188,9 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1186,9 +1188,9 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
for
key
,
value
in
getFieldDict
(
field
,
value_type
).
iteritems
():
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
if
isinstance
(
aq_base
(
value
),
(
Method
,
TALESMethod
)):
value
=
copyMethod
(
value
)
value
=
copyMethod
(
value
)
elif
value
is
not
None
and
not
isinstance
(
value
,
elif
not
(
value
is
None
or
(
str
,
unicode
,
int
,
long
,
float
,
bool
,
list
,
tuple
,
dic
t
)):
isinstance
(
value
,
self
.
_proxy_copy_type_lis
t
)):
raise
ValueError
,
'%s:%s'
%
(
type
(
value
),
repr
(
value
))
raise
ValueError
(
'%s:%r'
%
(
type
(
value
),
value
))
new_dict
[
key
]
=
value
new_dict
[
key
]
=
value
return
new_dict
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