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
c34fbed4
Commit
c34fbed4
authored
Jun 24, 2014
by
Tatuya Kamada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Predicate: Should not create PersitentMappings first time we see Predicate_view.
parent
05b1457f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
product/ERP5/tests/testPredicate.py
product/ERP5/tests/testPredicate.py
+16
-0
product/ERP5Type/Core/Predicate.py
product/ERP5Type/Core/Predicate.py
+4
-0
No files found.
product/ERP5/tests/testPredicate.py
View file @
c34fbed4
...
@@ -599,6 +599,22 @@ class TestPredicates(TestPredicateMixIn):
...
@@ -599,6 +599,22 @@ class TestPredicates(TestPredicateMixIn):
test_tales_expression
=
"python: 'france' in here.getRegion()"
)
test_tales_expression
=
"python: 'france' in here.getRegion()"
)
self
.
assertTrue
(
pred_true
.
test
(
doc
))
self
.
assertTrue
(
pred_true
.
test
(
doc
))
def
testPredicateViewWithOutModification
(
self
):
""" Make sure Predicate_view wihout modification does not change
the object."""
predicate
=
self
.
createPredicate
()
# when init Predicate, they are nothing
self
.
assertTrue
(
getattr
(
predicate
,
'_identity_criterion'
,
None
)
is
None
)
self
.
assertTrue
(
getattr
(
predicate
,
'_range_criterion'
,
None
)
is
None
)
# just view it, does not create PersistentMapping
predicate
.
Predicate_view
()
self
.
assertTrue
(
getattr
(
predicate
,
'_identity_criterion'
,
None
)
is
None
)
self
.
assertTrue
(
getattr
(
predicate
,
'_range_criterion'
,
None
)
is
None
)
# add property and view it, creates PersistentMapping
predicate
.
setCriterionPropertyList
([
'quantity'
])
predicate
.
Predicate_view
()
self
.
assertFalse
(
getattr
(
predicate
,
'_identity_criterion'
,
None
)
is
None
)
self
.
assertFalse
(
getattr
(
predicate
,
'_range_criterion'
,
None
)
is
None
)
# TODO :
# TODO :
# multi membership category
# multi membership category
...
...
product/ERP5Type/Core/Predicate.py
View file @
c34fbed4
...
@@ -381,6 +381,10 @@ class Predicate(XMLObject):
...
@@ -381,6 +381,10 @@ class Predicate(XMLObject):
XXX - It would be better to return criteria in a Criterion class
XXX - It would be better to return criteria in a Criterion class
instance
instance
"""
"""
# We do not create PersistentMappings first time we *see* Predicate_view.
# Instead, we create them first time we modify Predicate document.
if
not
self
.
getCriterionPropertyList
():
return
[]
if
getattr
(
aq_base
(
self
),
'_identity_criterion'
,
None
)
is
None
:
if
getattr
(
aq_base
(
self
),
'_identity_criterion'
,
None
)
is
None
:
self
.
_identity_criterion
=
PersistentMapping
()
self
.
_identity_criterion
=
PersistentMapping
()
self
.
_range_criterion
=
PersistentMapping
()
self
.
_range_criterion
=
PersistentMapping
()
...
...
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