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
Aurélien Vermylen
erp5
Commits
9ceca751
Commit
9ceca751
authored
Sep 19, 2017
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Formulator: prepare DateTimeField's sub_form dynamically.
parent
b6713cc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
42 deletions
+3
-42
product/ERP5Form/tests/testFields.py
product/ERP5Form/tests/testFields.py
+3
-37
product/Formulator/XMLToForm.py
product/Formulator/XMLToForm.py
+0
-5
No files found.
product/ERP5Form/tests/testFields.py
View file @
9ceca751
...
...
@@ -765,8 +765,9 @@ class TestProxyField(ERP5TypeTestCase):
proxy_field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
field_id
=
'my_date'
,))
self
.
assertTrue
(
hasattr
(
proxy_field
,
'sub_form'
))
self
.
assertTrue
(
aq_base
(
proxy_field
.
sub_form
)
is
aq_base
(
original_field
.
sub_form
))
self
.
assertEqual
(
proxy_field
.
sub_form
.
render
(),
original_field
.
sub_form
.
render
())
# we can render
proxy_field
.
render
()
# and validate
...
...
@@ -987,41 +988,6 @@ class TestFieldValueCache(ERP5TypeTestCase):
self
.
root
.
form
.
proxy_field_tales
.
get_value
(
'title'
)
self
.
assertEqual
(
True
,
cache_size
==
self
.
_getCacheSize
(
'ProxyField.get_value'
))
def
test_datetime_field
(
self
):
field_value_cache
.
clear
()
# make sure that boundmethod must not be cached.
year_field
=
self
.
root
.
form
.
datetime_field
.
sub_form
.
get_field
(
'year'
,
include_disabled
=
1
)
self
.
assertEqual
(
True
,
type
(
year_field
.
overrides
[
'items'
])
is
BoundMethod
)
cache_size
=
len
(
field_value_cache
)
year_field
.
get_value
(
'items'
)
# See Formulator/StandardFields.py(line:174)
# there are two get_value, start_datetime and end_datetime
cache_size
+=
2
# make sure that boundmethod is not cached(cache size does not change)
self
.
assertEqual
(
True
,
(
'Form.get_value'
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
'start_datetime'
)
in
field_value_cache
)
self
.
assertEqual
(
True
,
(
'Form.get_value'
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
'end_datetime'
)
in
field_value_cache
)
self
.
assertEqual
(
False
,
(
'Form.get_value'
,
year_field
.
_p_oid
,
year_field
.
_p_oid
,
'items'
)
in
field_value_cache
)
self
.
assertEqual
(
cache_size
,
len
(
field_value_cache
))
year_field
.
get_value
(
'size'
)
year_field
.
get_value
(
'default'
)
self
.
assertEqual
(
cache_size
+
2
,
len
(
field_value_cache
))
def
makeDummyOid
():
import
time
,
random
...
...
product/Formulator/XMLToForm.py
View file @
9ceca751
...
...
@@ -91,11 +91,6 @@ def XMLToForm(s, form, override_encoding=None):
else
:
field
.
values
[
name
]
=
encode
(
value
.
text
,
encoding
)
# special hack for the DateTimeField
if
field
.
meta_type
==
'DateTimeField'
:
field
.
on_value_input_style_changed
(
field
.
get_value
(
'input_style'
))
# set tales
tales
=
entry
.
first
.
tales
for
name
in
tales
.
getElementNames
():
...
...
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