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
Tomáš Peterka
erp5
Commits
ba690b47
Commit
ba690b47
authored
Oct 17, 2011
by
Leonardo Rochael Almeida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix passing of extra catalog parameters to DomainTool.searchPredicateList()
And add a test checking this in portal_rules
parent
882028a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
product/ERP5/tests/testRule.py
product/ERP5/tests/testRule.py
+31
-0
product/ZSQLCatalog/SQLExpression.py
product/ZSQLCatalog/SQLExpression.py
+1
-1
No files found.
product/ERP5/tests/testRule.py
View file @
ba690b47
...
@@ -352,6 +352,37 @@ return context.generatePredicate(
...
@@ -352,6 +352,37 @@ return context.generatePredicate(
self
.
stepTic
()
self
.
stepTic
()
self
.
assertEqual
(
len
(
rule_tool
.
searchRuleList
(
self
.
sm
)),
1
)
self
.
assertEqual
(
len
(
rule_tool
.
searchRuleList
(
self
.
sm
)),
1
)
def
test_072_search_with_extra_catalog_keywords
(
self
):
"""
test that a category criteria on a rule that doesn't have that category
allows the rule to match contexts with and without that category
"""
skin_folder
=
self
.
getPortal
().
portal_skins
.
custom
rule_tool
=
self
.
getRuleTool
()
# add an always-matching predicate test script to the rule
createZODBPythonScript
(
skin_folder
,
'good_script'
,
'rule'
,
'return True'
)
delivery_rule
=
self
.
getRule
(
'default_delivery_rule'
)
delivery_rule
.
setTestMethodId
(
'good_script'
)
delivery_rule
.
validate
()
transaction
.
commit
()
self
.
tic
()
# Now since the rule has a trade_phase
self
.
assertEqual
(
delivery_rule
.
getTradePhaseList
(),
[
'default/delivery'
])
# then it should be possible to find it by passing this trade_phase
# as an additional catalog keyword
kw
=
{
'trade_phase_relative_url'
:
[
'trade_phase/'
+
path
for
path
in
delivery
.
getTradePhaseList
()]}
# XXX-Leo: Fugly catalog syntax for category search above.
self
.
assertEqual
(
len
(
rule_tool
.
searchRuleList
(
self
.
sm
,
**
kw
)),
1
)
# and also not to match it if we pass a different trade_phase
kw
[
'trade_phase_relative_url'
]
=
[
'trade_phase/'
+
'default/order'
]
self
.
assertEqual
(
len
(
rule_tool
.
searchRuleList
(
self
.
sm
,
**
kw
)),
0
)
# but match it again if we pass an empty list for trade_phase
# (with a warning in the log about discarding empty values)
kw
[
'trade_phase_relative_url'
]
=
[]
self
.
assertEqual
(
len
(
rule_tool
.
searchRuleList
(
self
.
sm
,
**
kw
)),
1
)
def
test_08_updateAppliedRule
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_08_updateAppliedRule
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
"""
"""
test that when updateAppliedRule is called, the rule with the correct
test that when updateAppliedRule is called, the rule with the correct
...
...
product/ZSQLCatalog/SQLExpression.py
View file @
ba690b47
...
@@ -395,7 +395,7 @@ class SQLExpression(object):
...
@@ -395,7 +395,7 @@ class SQLExpression(object):
from_expression_dict
=
self
.
getFromExpression
()
from_expression_dict
=
self
.
getFromExpression
()
if
from_expression_dict
is
not
None
:
if
from_expression_dict
is
not
None
:
from_expression
=
SQL_LIST_SEPARATOR
.
join
(
from_expression
=
SQL_LIST_SEPARATOR
.
join
(
from_expression_dict
.
get
(
table
,
'`%s` AS `%s`'
%
(
table
,
alias
))
from_expression_dict
.
get
(
alias
,
'`%s` AS `%s`'
%
(
table
,
alias
))
for
alias
,
table
in
table_alias_dict
.
iteritems
())
for
alias
,
table
in
table_alias_dict
.
iteritems
())
else
:
else
:
from_expression
=
None
from_expression
=
None
...
...
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