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
Ekaterina
erp5
Commits
daffb775
Commit
daffb775
authored
10 years ago
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: use new syntax (from Python 2.7) for set comprehensions
parent
742d237c
No related merge requests found
Changes
52
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
196 additions
and
228 deletions
+196
-228
product/ERP5/Document/AppliedRule.py
product/ERP5/Document/AppliedRule.py
+1
-1
product/ERP5/Document/BusinessProcess.py
product/ERP5/Document/BusinessProcess.py
+1
-2
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+12
-14
product/ERP5/Document/CategoryBudgetVariation.py
product/ERP5/Document/CategoryBudgetVariation.py
+2
-2
product/ERP5/Document/Delivery.py
product/ERP5/Document/Delivery.py
+1
-1
product/ERP5/Document/NodeBudgetVariation.py
product/ERP5/Document/NodeBudgetVariation.py
+2
-2
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
...ct/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
+1
-1
product/ERP5/Document/TradeModelSolver.py
product/ERP5/Document/TradeModelSolver.py
+2
-2
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+3
-3
product/ERP5/MovementCollectionDiff.py
product/ERP5/MovementCollectionDiff.py
+3
-5
product/ERP5/MovementGroup.py
product/ERP5/MovementGroup.py
+1
-1
product/ERP5/Tool/ContributionTool.py
product/ERP5/Tool/ContributionTool.py
+1
-2
product/ERP5/Tool/TaskDistributionTool.py
product/ERP5/Tool/TaskDistributionTool.py
+2
-2
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+1
-1
product/ERP5/mixin/amount_generator.py
product/ERP5/mixin/amount_generator.py
+2
-2
product/ERP5/tests/testAccountingReports.py
product/ERP5/tests/testAccountingReports.py
+3
-3
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+3
-3
product/ERP5/tests/testERP5Base.py
product/ERP5/tests/testERP5Base.py
+6
-7
product/ERP5/tests/testInventory.py
product/ERP5/tests/testInventory.py
+3
-3
product/ERP5/tests/testInvoice.py
product/ERP5/tests/testInvoice.py
+1
-1
product/ERP5/tests/testPredicate.py
product/ERP5/tests/testPredicate.py
+4
-4
product/ERP5/tests/testSimulationElementPerformance.py
product/ERP5/tests/testSimulationElementPerformance.py
+18
-18
product/ERP5/tests/testTransformation.py
product/ERP5/tests/testTransformation.py
+2
-4
product/ERP5/tests/testTranslation.py
product/ERP5/tests/testTranslation.py
+7
-9
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+13
-14
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
+1
-1
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+2
-2
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+11
-18
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+1
-1
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+2
-2
product/ERP5OOo/tests/testIngestion.py
product/ERP5OOo/tests/testIngestion.py
+2
-2
product/ERP5OOo/tests/testOOoImport.py
product/ERP5OOo/tests/testOOoImport.py
+3
-4
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+3
-4
product/ERP5Type/Accessor/Value.py
product/ERP5Type/Accessor/Value.py
+1
-1
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+12
-13
product/ERP5Type/CodingStyle.py
product/ERP5Type/CodingStyle.py
+1
-2
product/ERP5Type/Core/Predicate.py
product/ERP5Type/Core/Predicate.py
+19
-23
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+2
-2
product/ERP5Type/Tool/PropertySheetTool.py
product/ERP5Type/Tool/PropertySheetTool.py
+4
-4
product/ERP5Type/XMLUtils.py
product/ERP5Type/XMLUtils.py
+3
-3
product/ERP5Type/dynamic/accessor_holder.py
product/ERP5Type/dynamic/accessor_holder.py
+2
-2
product/ERP5Type/dynamic/persistent_migration.py
product/ERP5Type/dynamic/persistent_migration.py
+1
-1
product/ERP5Type/patches/DA.py
product/ERP5Type/patches/DA.py
+1
-1
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+2
-2
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+5
-7
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+2
-2
product/ERP5Type/tests/runUnitTest.py
product/ERP5Type/tests/runUnitTest.py
+2
-2
product/ERP5Type/tests/testERP5Type.py
product/ERP5Type/tests/testERP5Type.py
+4
-4
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+4
-4
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+8
-11
product/ZSQLCatalog/SQLExpression.py
product/ZSQLCatalog/SQLExpression.py
+2
-2
product/ZSQLCatalog/SearchText/SearchTextParser.py
product/ZSQLCatalog/SearchText/SearchTextParser.py
+1
-1
No files found.
product/ERP5/Document/AppliedRule.py
View file @
daffb775
...
...
@@ -272,7 +272,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
break
if
root_rule
:
self
.
_setSpecialise
(
root_rule
)
delivery_set
=
set
((
delivery
,))
delivery_set
=
{
delivery
}
def
updateMovementCollection
(
rule
,
context
,
*
args
,
**
kw
):
orig_updateMovementCollection
(
rule
,
context
,
*
args
,
**
kw
)
new_parent
=
context
.
getParentValue
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/BusinessProcess.py
View file @
daffb775
...
...
@@ -136,8 +136,7 @@ class BusinessProcess(Path, XMLObject):
if
trade_phase
is
not
None
:
if
isinstance
(
trade_phase
,
basestring
):
trade_phase
=
(
trade_phase
,)
trade_phase
=
set
(
x
.
split
(
'trade_phase/'
,
1
)[
-
1
]
for
x
in
trade_phase
)
trade_phase
=
{
x
.
split
(
'trade_phase/'
,
1
)[
-
1
]
for
x
in
trade_phase
}
kw
.
setdefault
(
'portal_type'
,
self
.
getPortalTradeModelPathTypeList
())
kw
.
setdefault
(
'sort_on'
,
'int_index'
)
original_path_list
=
self
.
objectValues
(
**
kw
)
# Why Object Values ??? XXX-JPS
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/BusinessTemplate.py
View file @
daffb775
...
...
@@ -558,9 +558,9 @@ class BaseTemplateItem(Implicit, Persistent):
klass
=
obj
.
__class__
classname
=
klass
.
__name__
attr_set
=
set
((
'_dav_writelocks'
,
'_filepath'
,
'_owner'
,
'_related_index'
,
'last_id'
,
'uid'
,
'__ac_local_roles__'
,
'__ac_local_roles_group_id_dict__'
))
attr_set
=
{
'_dav_writelocks'
,
'_filepath'
,
'_owner'
,
'_related_index'
,
'last_id'
,
'uid'
,
'__ac_local_roles__'
,
'__ac_local_roles_group_id_dict__'
}
if
export
:
if
keep_workflow_history_last_history_only
:
self
.
_removeAllButLastWorkflowHistory
(
obj
)
...
...
@@ -2002,14 +2002,12 @@ class WorkflowTemplateItem(ObjectTemplateItem):
context
.
getTemplatePortalTypeWorkflowChainList
()]
chain_dict
=
getChainByType
(
context
)[
1
]
for
workflow_id
in
removed_workflow_id_list
:
affected_portal_type_set
=
set
([
x
[
0
][
6
:]
for
x
in
\
chain_dict
.
iteritems
()
\
if
workflow_id
in
\
[
y
.
strip
()
for
y
in
x
[
1
].
split
(
','
)]])
safe_portal_type_set
=
set
([
x
[
0
]
for
x
in
installed_chain_list
\
if
x
[
1
]
==
workflow_id
])
-
\
set
([
x
[
0
]
for
x
in
new_chain_list
\
if
x
[
1
]
==
workflow_id
])
affected_portal_type_set
=
{
x
[
6
:]
for
x
,
y
in
chain_dict
.
iteritems
()
if
any
(
workflow_id
==
y
.
strip
()
for
y
in
y
.
split
(
','
))}
safe_portal_type_set
=
{
x
for
x
,
y
in
installed_chain_list
if
y
==
workflow_id
}
safe_portal_type_set
.
difference_update
(
x
for
x
,
y
in
new_chain_list
if
y
==
workflow_id
)
if
affected_portal_type_set
-
safe_portal_type_set
:
value
=
modified_workflow_dict
[
'portal_workflow/%s'
%
workflow_id
]
modified_workflow_dict
[
'portal_workflow/%s'
%
workflow_id
]
=
\
...
...
@@ -2057,10 +2055,10 @@ class WorkflowTemplateItem(ObjectTemplateItem):
object_keys
=
[
object_path
]
else
:
object_keys
=
self
.
_archive
.
keys
()
removed_workflow_id_list
=
set
([
x
.
split
(
'/'
,
1
)[
1
]
for
x
in
object_keys
])
removed_workflow_id_list
=
{
x
.
split
(
'/'
,
1
)[
1
]
for
x
in
object_keys
}
(
default_chain
,
chain_dict
)
=
getChainByType
(
context
)
for
portal_type
,
workflow_ids
in
chain_dict
.
iteritems
():
workflow_ids
=
set
([
x
.
strip
()
for
x
in
workflow_ids
.
split
(
','
)])
-
\
workflow_ids
=
{
x
.
strip
()
for
x
in
workflow_ids
.
split
(
','
)}
-
\
removed_workflow_id_list
chain_dict
[
portal_type
]
=
', '
.
join
(
workflow_ids
)
context
.
portal_workflow
.
manage_changeWorkflows
(
default_chain
,
...
...
@@ -2510,7 +2508,7 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem):
self
.
business_template_class_property
).
_objects
else
:
old_objects
=
{}
for
key
in
set
(
self
.
_objects
.
keys
()).
union
(
set
(
old_objects
.
keys
()
)):
for
key
in
set
(
self
.
_objects
.
keys
()).
union
(
old_objects
.
keys
(
)):
if
key
in
update_dict
or
force
:
if
not
force
:
action
=
update_dict
[
key
]
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/CategoryBudgetVariation.py
View file @
daffb775
...
...
@@ -84,9 +84,9 @@ class CategoryBudgetVariation(BudgetVariation):
item_list
=
self
.
getBudgetLineVariationRangeCategoryList
(
budget_line
)
if
matrixbox
:
used_node_item_set
=
set
([
item
[
0
]
for
item
in
cell_range
[
0
]])
used_node_item_set
=
{
item
[
0
]
for
item
in
cell_range
[
0
]}
else
:
used_node_item_set
=
set
([
item
for
item
in
cell_range
[
0
]])
used_node_item_set
=
{
item
for
item
in
cell_range
[
0
]}
if
engaged_budget
:
consumption_dict
=
budget_line
.
getConsumedBudgetDict
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/Delivery.py
View file @
daffb775
...
...
@@ -224,7 +224,7 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
if
movement_list
:
if
isinstance
(
portal_type
,
str
):
portal_type
=
set
((
portal_type
,))
portal_type
=
portal_type
,
elif
isinstance
(
portal_type
,
(
list
,
tuple
)):
portal_type
=
set
(
portal_type
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/NodeBudgetVariation.py
View file @
daffb775
...
...
@@ -119,9 +119,9 @@ class NodeBudgetVariation(BudgetVariation):
self
.
_getNodeTitle
(
node
))
for
node
in
self
.
_getNodeList
(
budget_line
)]
if
matrixbox
:
used_node_item_set
=
set
([
item
[
0
]
for
item
in
cell_range
[
0
]])
used_node_item_set
=
{
item
[
0
]
for
item
in
cell_range
[
0
]}
else
:
used_node_item_set
=
set
([
item
for
item
in
cell_range
[
0
]])
used_node_item_set
=
{
item
for
item
in
cell_range
[
0
]}
if
engaged_budget
:
consumption_dict
=
budget_line
.
getConsumedBudgetDict
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
View file @
daffb775
...
...
@@ -135,7 +135,7 @@ class SQLNonContinuousIncreasingIdGenerator(IdGenerator):
id_group_done
.
append
(
id_group
)
# save the last ids which not exist in sql
for
id_group
in
(
set
(
self
.
last_max_id_dict
.
keys
())
-
set
(
id_group_done
)
):
for
id_group
in
set
(
self
.
last_max_id_dict
).
difference
(
id_group_done
):
set_last_id_method
(
id_group
=
id_group
,
last_id
=
self
.
last_max_id_dict
[
id_group
].
value
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Document/TradeModelSolver.py
View file @
daffb775
...
...
@@ -78,8 +78,8 @@ class TradeModelSolver(AcceptSolver):
# related lines.
# XXX is there any better way than using rule's reference?
trade_model_related_movement_dict
=
{}
for
delivery
in
set
(
movement
.
getRootDeliveryValue
()
for
movement
in
delivery_dict
)
:
for
delivery
in
{
movement
.
getRootDeliveryValue
()
for
movement
in
delivery_dict
}
:
for
movement
in
delivery
.
getMovementList
():
movement_list
=
delivery_dict
.
get
(
movement
)
# hard coded reference name
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/ERP5Site.py
View file @
daffb775
...
...
@@ -1801,10 +1801,10 @@ class ERP5Generator(PortalGenerator):
container_path
=
root
[
prefix_len
:]
load
=
traverse
(
container_path
).
_importObjectFromFile
if
container_path
:
id_set
=
set
(
x
[:
-
4
]
for
x
in
files
if
x
[
-
4
:]
==
'.xml'
)
id_set
=
{
x
[:
-
4
]
for
x
in
files
if
x
[
-
4
:]
==
'.xml'
}
else
:
id_set
=
set
(
quote
(
x
)
for
x
in
content_id_list
if
not
context
.
hasObject
(
x
))
id_set
=
{
quote
(
x
)
for
x
in
content_id_list
if
not
context
.
hasObject
(
x
)}
dirs
[:]
=
id_set
.
intersection
(
dirs
)
for
file
in
id_set
:
load
(
os
.
path
.
join
(
root
,
file
+
'.xml'
),
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/MovementCollectionDiff.py
View file @
daffb775
...
...
@@ -120,10 +120,8 @@ def _getPropertyList(document, acquire=True):
return
property_dict
def
_getCategoryList
(
document
,
acquire
=
True
):
bad_category_list
=
[
'solver'
,
]
# we care already stored category only
document_category_set
=
set
([
x
.
split
(
'/'
,
1
)[
0
]
for
x
in
\
document
.
getCategoryList
()])
document_category_set
=
{
x
.
split
(
'/'
,
1
)[
0
]
for
x
in
document
.
getCategoryList
()}
getPropertyList
=
document
.
getPropertyList
return
dict
([(
x
,
getPropertyList
(
x
))
for
x
in
document_category_set
\
if
x
not
in
bad_category_list
])
return
{
x
:
getPropertyList
(
x
)
for
x
in
document_category_set
if
x
!=
'solver'
}
This diff is collapsed.
Click to expand it.
product/ERP5/MovementGroup.py
View file @
daffb775
...
...
@@ -341,7 +341,7 @@ class FakeMovement:
Be careful: behaviour differs from CMFCategory in that returned
list may include None, when there is at least 1 unlinked SM.
"""
return
list
(
set
(
x
.
getDelivery
()
for
x
in
self
.
__movement_list
)
)
return
list
(
{
x
.
getDelivery
()
for
x
in
self
.
__movement_list
}
)
def
getDeliveryValue
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Tool/ContributionTool.py
View file @
daffb775
...
...
@@ -511,8 +511,7 @@ class ContributionTool(BaseTool):
if
depth
<
0
:
# Do nothing if crawling depth is reached
return
url_list
=
content
.
getContentNormalisedURLList
()
for
url
in
set
(
url_list
):
for
url
in
set
(
content
.
getContentNormalisedURLList
()):
# LOG('trying to crawl', 0, url)
# Some url protocols should not be crawled
if
urlparse
.
urlsplit
(
url
)[
0
]
in
no_crawl_protocol_list
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Tool/TaskDistributionTool.py
View file @
daffb775
...
...
@@ -220,8 +220,8 @@ class TaskDistributionTool(BaseTool):
if
test_result
.
getSimulationState
()
==
'started'
:
if
line
.
getSimulationState
()
==
"started"
:
line
.
stop
(
**
status_dict
)
if
set
([
x
.
getSimulationState
()
for
x
in
test_result
.
objectValues
(
portal_type
=
"Test Result Line"
)])
==
set
([
"stopped"
])
:
if
{
"stopped"
}
==
{
x
.
getSimulationState
()
for
x
in
test_result
.
objectValues
(
portal_type
=
"Test Result Line"
)}
:
test_result
.
stop
()
def
_extractXMLRPCDict
(
self
,
xmlrpc_dict
):
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Tool/TemplateTool.py
View file @
daffb775
...
...
@@ -1114,7 +1114,7 @@ class TemplateTool (BaseTool):
template_title_list = set(template_title_list)
installed_bt5_title_list = self.getInstalledBusinessTemplateTitleList()
bt5_set = set(
[]
)
bt5_set = set()
for available_bt5 in available_bt5_list:
if available_bt5.title in template_title_list:
template_title_list.remove(available_bt5.title)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/mixin/amount_generator.py
View file @
daffb775
...
...
@@ -229,8 +229,8 @@ class BaseAmountResolver(BaseAmountDict):
variated_base_amount
=
base_amount
,
variation_category_list
resolving
=
self
.
_resolving
if
variated_base_amount
not
in
self
.
_dict
:
self
.
_resolving
=
self
.
_dict
[
variated_base_amount
]
=
set
(
(
variated_base_amount
,))
self
.
_resolving
=
self
.
_dict
[
variated_base_amount
]
=
\
{
variated_base_amount
}
self
.
_getGeneratedAmountQuantity
(
base_amount
,
variation_category_list
)
self
.
_resolving
=
resolving
resolving
|=
self
.
_dict
[
variated_base_amount
]
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testAccountingReports.py
View file @
daffb775
...
...
@@ -2016,9 +2016,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list
=
[
l
for
l
in
line_list
if
l
.
isDataLine
()]
self
.
assertEqual
(
2
,
len
(
data_line_list
))
self
.
assertEqual
(
set
([
line
.
getColumnProperty
(
'Movement_getSpecificReference'
)
for
line
in
data_line_list
])
,
set
((
'Source Reference'
,
'Destination Reference'
))
)
{
line
.
getColumnProperty
(
'Movement_getSpecificReference'
)
for
line
in
data_line_list
}
,
{
'Source Reference'
,
'Destination Reference'
}
)
for
line
in
data_line_list
:
if
line
.
getColumnProperty
(
'Movement_getSpecificReference'
)
\
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testBusinessTemplate.py
View file @
daffb775
...
...
@@ -6623,9 +6623,9 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_object
.
__ac_local_roles__
=
dict
(
group
=
[
'Assignee'
,
'Assignor'
],
another_group
=
[
'Assignee'
])
initial___ac_local_roles_group_id_dict__
=
dict
(
Alternate
=
set
([(
'group'
,
'Assignee'
)])
,
Another
=
set
([
(
'group'
,
'Assignor'
),
(
'another_group'
,
'Assignee'
)])).
copy
(
)
Alternate
=
{(
'group'
,
'Assignee'
)}
,
Another
=
{
(
'group'
,
'Assignor'
),
(
'another_group'
,
'Assignee'
)}
)
new_object
.
__ac_local_roles_group_id_dict__
=
initial___ac_local_roles_group_id_dict__
self
.
tic
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testERP5Base.py
View file @
daffb775
...
...
@@ -1073,13 +1073,12 @@ class TestERP5Base(ERP5TypeTestCase):
# patch the method, we'll abort later
self
.
portal
.
Localizer
.
get_selected_language
=
lambda
:
lang
self
.
assertEqual
(
set
([
person_1
,
person_2
]),
set
([
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_portal_type
=
'Personne'
)]))
self
.
assertEqual
(
set
([
person_2
,
organisation
]),
set
([
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Brouillon'
,
portal_type
=
(
'Person'
,
'Organisation'
))]))
self
.
assertEqual
({
person_1
,
person_2
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_portal_type
=
'Personne'
)})
self
.
assertEqual
({
person_2
,
organisation
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Brouillon'
,
portal_type
=
(
'Person'
,
'Organisation'
))})
self
.
assertEqual
([
person_2
],
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Brouillon'
,
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testInventory.py
View file @
daffb775
...
...
@@ -2383,10 +2383,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
try
:
self
.
assertEqual
(
len
(
expected_history
),
len
(
actual_history
))
for
expected
,
actual
in
zip
(
expected_history
,
actual_history
):
shared_keys
=
set
(
expected
.
keys
())
&
set
(
actual
.
keys
()
)
self
.
assertEqual
(
len
(
shared_keys
),
len
(
expected
.
keys
()
))
shared_keys
=
set
(
expected
)
&
set
(
actual
)
self
.
assertEqual
(
len
(
shared_keys
),
len
(
expected
))
shared_item
=
set
(
expected
.
items
())
&
set
(
actual
.
items
())
self
.
assertEqual
(
len
(
shared_item
),
len
(
expected
.
keys
()
))
self
.
assertEqual
(
len
(
shared_item
),
len
(
expected
))
except
AssertionError
:
msg
=
'History differs between expected:
\
n
%s
\
n
and real:
\
n
%s'
\
%
(
repr
(
expected_history
),
repr
(
actual_history
))
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testInvoice.py
View file @
daffb775
...
...
@@ -1094,7 +1094,7 @@ class TestInvoiceMixin(TestPackingListMixin):
# for each movement, we want to make sure that each rule is not
# instanciated more than once
if
len
(
found_rule_dict
):
self
.
assertEqual
(
set
(
found_rule_dict
.
itervalues
()),
set
([
1
])
)
self
.
assertEqual
(
set
(
found_rule_dict
.
itervalues
()),
{
1
}
)
elif
k
==
'parent_movement_type_list'
:
if
rule
.
getParentValue
().
getDeliveryValue
()
is
not
None
:
parent_type
=
rule
.
getParentValue
().
getDeliveryValue
().
getPortalType
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testPredicate.py
View file @
daffb775
...
...
@@ -569,8 +569,8 @@ class TestPredicates(TestPredicateMixIn):
# check that if we define the same filter than on predicate we get same result
self
.
assertEqual
(
len
(
predicate
.
searchResults
()),
2
)
self
.
assert
SameSet
(
set
([
x
.
getObject
()
for
x
in
predicate
.
searchResults
(
portal_type
=
[
'Person'
,
'Organisation'
])]),
set
([
fabien
,
nexedi
])
)
self
.
assert
Equal
({
fabien
,
nexedi
},
{
x
.
getObject
()
for
x
in
predicate
.
searchResults
(
portal_type
=
(
'Person'
,
'Organisation'
))}
)
# check that it's possible to filter results
self
.
assertEqual
([
x
.
getObject
()
for
x
in
\
...
...
@@ -583,8 +583,8 @@ class TestPredicates(TestPredicateMixIn):
currency_module
=
self
.
portal
.
getDefaultModule
(
'Currency'
)
euro
=
currency_module
.
newContent
(
title
=
'euro'
)
self
.
assert
SameSet
(
set
([
x
.
getObject
()
for
x
in
predicate
.
searchResults
(
portal_type
=
[
'Person'
,
'Organisation'
])]),
set
([
fabien
,
nexedi
])
)
self
.
assert
Equal
({
fabien
,
nexedi
},
{
x
.
getObject
()
for
x
in
predicate
.
searchResults
(
portal_type
=
(
'Person'
,
'Organisation'
))}
)
def
test_TalesExpression
(
self
):
# Predicates can test that a document is member of a category
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testSimulationElementPerformance.py
View file @
daffb775
...
...
@@ -476,9 +476,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
'Simulation Movement'
)
self
.
assertEqual
(
simulation_movement
.
getQuantity
(),
1.0
)
self
.
assertEqual
(
simulation_movement
.
getResource
(),
resource
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/order_path'
,
'business_process_module/test_bp/order'
))
)
'business_process_module/test_bp/order'
}
)
self
.
assertEqual
(
simulation_movement
.
getDestinationDecision
(),
destination_decision
)
self
.
assertEqual
(
simulation_movement
.
getDestinationAdministration
(),
...
...
@@ -512,9 +512,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/deliver_path'
,
'business_process_module/test_bp/deliver'
))
)
'business_process_module/test_bp/deliver'
}
)
def
stepCheckBuiltSaleInvoices
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -547,9 +547,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
))
)
'business_process_module/test_bp/invoice'
}
)
tax_invoice_line
=
invoice_line_list
[
1
]
self
.
assertEqual
(
tax_invoice_line
.
getResource
(),
...
...
@@ -568,10 +568,10 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
,
'sale_trade_condition_module/test_stc/vat_low'
))
)
'sale_trade_condition_module/test_stc/vat_low'
}
)
def
stepCheckAddedSaleInvoices
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -604,9 +604,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
))
)
'business_process_module/test_bp/invoice'
}
)
luxury_invoice_line
=
invoice_line_list
[
1
]
self
.
assertEqual
(
luxury_invoice_line
.
getResource
(),
...
...
@@ -622,9 +622,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
))
)
'business_process_module/test_bp/invoice'
}
)
high_tax_invoice_line
=
invoice_line_list
[
2
]
self
.
assertEqual
(
high_tax_invoice_line
.
getResource
(),
...
...
@@ -641,10 +641,10 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
,
'sale_trade_condition_module/test_stc/vat_high'
))
)
'sale_trade_condition_module/test_stc/vat_high'
}
)
low_tax_invoice_line
=
invoice_line_list
[
3
]
self
.
assertEqual
(
low_tax_invoice_line
.
getResource
(),
...
...
@@ -663,10 +663,10 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for
simulation_movement
in
simulation_movement_list
:
self
.
assertEqual
(
simulation_movement
.
getPortalType
(),
'Simulation Movement'
)
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/invoice_path'
,
'business_process_module/test_bp/invoice'
,
'sale_trade_condition_module/test_stc/vat_low'
))
)
'sale_trade_condition_module/test_stc/vat_low'
}
)
def
stepCheckConvergedSalePackingLists
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -713,9 +713,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
delivery
.
getQuantity
())
self
.
assertEqual
(
simulation_movement
.
getResource
(),
delivery
.
getResource
())
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
set
((
self
.
assertEqual
(
set
(
simulation_movement
.
getCausalityList
()),
{
'business_process_module/test_bp/deliver_path'
,
'business_process_module/test_bp/deliver'
))
)
'business_process_module/test_bp/deliver'
}
)
self
.
assertEqual
(
simulation_movement
.
getDestinationDecision
(),
destination_decision
)
self
.
assertEqual
(
simulation_movement
.
getDestinationAdministration
(),
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testTransformation.py
View file @
daffb775
...
...
@@ -175,10 +175,8 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion):
transformation
.
setResourceValue
(
swimcap
)
self
.
tic
()
self
.
assertSameSet
(
set
(
swimcap
.
getVariationCategoryList
()),
set
(
transformation
.
getVariationCategoryList
()),
)
self
.
assertSameSet
(
swimcap
.
getVariationCategoryList
(),
transformation
.
getVariationCategoryList
())
def
test_variationCategoryWithIndividualVariation
(
self
):
'''Check that individual variation are return when getVariationCategoryList
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testTranslation.py
View file @
daffb775
...
...
@@ -135,10 +135,10 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
translated_state_title
=
self
.
getTranslation
(
msgid
)
if
translated_state_title
is
not
None
:
if
translation_dict
.
has_key
(
translated_state_title
)
:
try
:
translation_dict
[
translated_state_title
].
add
(
state_id
)
e
lse
:
translation_dict
[
translated_state_title
]
=
set
([
state_id
])
e
xcept
KeyError
:
translation_dict
[
translated_state_title
]
=
{
state_id
}
for
key
,
value
in
translation_dict
.
items
():
...
...
@@ -460,14 +460,12 @@ class TestTranslation(ERP5TypeTestCase):
portal_type
=
'Organisation'
)
self
.
tic
()
self
.
assertEqual
(
set
([
person_1
,
person_2
]),
set
([
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_portal_type
=
'Personne'
)]))
self
.
assertEqual
({
person_1
,
person_2
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_portal_type
=
'Personne'
)})
self
.
assertEqual
(
set
([
person_2
,
organisation
]),
set
([
x
.
getObject
()
for
x
in
self
.
assertEqual
({
person_2
,
organisation
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Brouillon'
,
portal_type
=
(
'Person'
,
'Organisation'
))
])
)
portal_type
=
(
'Person'
,
'Organisation'
))
}
)
self
.
assertEqual
([
person_2
],
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Brouillon'
,
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
daffb775
...
...
@@ -408,7 +408,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
(
0
,
message_count
)
# Check if all objects are catalogued as before
new_path_list
=
self
.
getSQLPathList
()
self
.
assert
Equal
(
set
(
original_path_list
)
-
set
(
new_path_list
),
set
(
))
self
.
assert
True
(
set
(
original_path_list
).
issubset
(
new_path_list
))
def
test_14_ReindexWithBrokenCategory
(
self
):
"""Reindexing an object with 1 broken category must not affect other valid
...
...
@@ -1046,10 +1046,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
for
k
,
v
in
query_dict
.
items
():
setattr
(
query_record
,
k
,
v
)
self
.
assertEqual
(
set
([
org_b
.
getPath
(),
org_c
.
getPath
()]),
set
([
x
.
path
for
x
in
self
.
getCatalogTool
()(
portal_type
=
'Organisation'
,
title
=
query_record
)]))
self
.
assertEqual
({
org_b
.
getPath
(),
org_c
.
getPath
()},
{
x
.
path
for
x
in
self
.
getCatalogTool
()(
portal_type
=
'Organisation'
,
title
=
query_record
)})
def
test_39_DeferredConnection
(
self
):
"""ERP5Catalog uses a deferred connection for full text indexing.
...
...
@@ -1329,7 +1328,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self
.
tic
()
original_path_list
=
self
.
getSQLPathList
(
self
.
original_connection_id
)
new_path_list
=
self
.
getSQLPathList
(
self
.
new_connection_id
)
self
.
assert
Equal
(
set
(
original_path_list
)
-
set
(
new_path_list
),
set
(
))
self
.
assert
True
(
set
(
original_path_list
).
issubset
(
new_path_list
))
self
.
organisation2
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
"GreatTitle2"
)
first_deleted_url
=
self
.
organisation2
.
getRelativeUrl
()
...
...
@@ -2107,9 +2106,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# future, in this case, this test have to be updated)
self
.
assertSameSet
([
doc
],
[
x
.
getObject
()
for
x
in
ctool
(
portal_type
=
'Organisation'
,
description
=
'Foo'
)])
self
.
assertEqual
(
set
([
doc
,
other_doc
]),
set
([
x
.
getObject
()
for
x
in
self
.
assertEqual
(
{
doc
,
other_doc
},
{
x
.
getObject
()
for
x
in
ctool
(
portal_type
=
'Organisation'
,
description
=
dict
(
query
=
'Foo'
,
key
=
'Keyword'
))
])
)
key
=
'Keyword'
))
}
)
def
test_ignore_empty_string
(
self
):
...
...
@@ -2119,13 +2118,13 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
ctool
=
self
.
getCatalogTool
()
def
searchResults
(
**
kw
):
kw
[
'portal_type'
]
=
'Organisation'
return
set
([
x
.
getObject
()
for
x
in
ctool
.
searchResults
(
**
kw
)])
return
{
x
.
getObject
()
for
x
in
ctool
.
searchResults
(
**
kw
)}
# description='' is ignored
self
.
assertEqual
(
set
([
doc_with_empty_description
,
doc_with_description
])
,
self
.
assertEqual
(
{
doc_with_empty_description
,
doc_with_description
}
,
searchResults
(
description
=
''
))
# unless we exlicitly say we don't want to ignore empty strings
self
.
assertEqual
(
set
([
doc_with_empty_description
])
,
self
.
assertEqual
(
{
doc_with_empty_description
}
,
searchResults
(
ignore_empty_string
=
0
,
description
=
''
))
def
test_ignore_empty_string_related_key
(
self
):
...
...
@@ -2138,11 +2137,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
ctool
=
self
.
getCatalogTool
()
def
searchResults
(
**
kw
):
kw
[
'portal_type'
]
=
'Organisation'
return
set
([
x
.
getObject
()
for
x
in
ctool
.
searchResults
(
**
kw
)])
return
{
x
.
getObject
()
for
x
in
ctool
.
searchResults
(
**
kw
)}
self
.
assertEqual
(
set
([
doc_with_empty_region_description
,
doc_without_region
])
,
self
.
assertEqual
(
{
doc_with_empty_region_description
,
doc_without_region
}
,
searchResults
(
region_description
=
''
))
self
.
assertEqual
(
set
([
doc_with_empty_region_description
])
,
self
.
assertEqual
(
{
doc_with_empty_region_description
}
,
searchResults
(
ignore_empty_string
=
0
,
region_description
=
''
))
def
test_complex_query
(
self
):
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
View file @
daffb775
...
...
@@ -186,7 +186,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
standard_bt5_config_save
=
business_configuration
[
'1'
]
self
.
assertEqual
(
set
(
self
.
standard_bt5_list
),
set
([
x
.
bt5_id
for
x
in
standard_bt5_config_save
.
contentValues
()])
)
{
x
.
bt5_id
for
x
in
standard_bt5_config_save
.
contentValues
()}
)
# third one: we create a business template to store customer configuration
custom_bt5_config_save
=
business_configuration
[
'2'
]
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Form/Form.py
View file @
daffb775
...
...
@@ -795,11 +795,11 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
portal
=
self
.
getPortalObject
()
folder_id
=
self
.
aq_parent
.
id
# Find a business template which manages the context skin folder.
folder_id_set
=
set
([
folder_id
])
folder_id_set
=
{
folder_id
}
for
template
in
portal
.
portal_templates
.
getInstalledBusinessTemplateList
():
template_skin_id_list
=
template
.
getTemplateSkinIdList
()
if
folder_id
in
template_skin_id_list
:
folder_id_set
.
update
(
set
(
template_skin_id_list
)
)
folder_id_set
.
update
(
template_skin_id_list
)
# Find folders which can be surcharged by this skin folder
if
'_'
in
folder_id
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Form/ListBox.py
View file @
daffb775
...
...
@@ -896,10 +896,10 @@ class ListBoxRenderer:
Make sure there is no duplicates.
"""
all_column_list
=
list
(
self
.
getColumnList
())
all_column_id_set
=
set
([
c
[
0
]
for
c
in
all_column_list
])
all_column_list
.
extend
(
[(
str
(
c
[
0
]),
unicode
(
c
[
1
],
self
.
getEncoding
()))
\
for
c
in
self
.
field
.
get_value
(
'all_columns'
)
\
if
c
[
0
]
not
in
all_column_id_set
]
)
all_column_id_set
=
{
c
[
0
]
for
c
in
all_column_list
}
all_column_list
.
extend
(
(
str
(
c
[
0
]),
unicode
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
self
.
field
.
get_value
(
'all_columns'
)
if
c
[
0
]
not
in
all_column_id_set
)
return
all_column_list
getAllColumnList
=
lazyMethod
(
getAllColumnList
)
...
...
@@ -1004,14 +1004,9 @@ class ListBoxRenderer:
"""
search_columns
=
self
.
field
.
get_value
(
'search_columns'
)
if
search_columns
:
search_column_id_list
=
[
c
[
0
]
for
c
in
search_columns
]
else
:
search_column_id_list
=
[]
isValidColumn
=
self
.
getCatalogTool
().
getSQLCatalog
().
isValidColumn
for
column_id
,
column_title
in
self
.
getAllColumnList
():
if
isValidColumn
(
column_id
):
search_column_id_list
.
append
(
column_id
)
return
set
(
search_column_id_list
)
return
{
c
[
0
]
for
c
in
search_columns
}
isValidColumn
=
self
.
getCatalogTool
().
getSQLCatalog
().
isValidColumn
return
{
id
for
id
,
title
in
self
.
getAllColumnList
()
if
isValidColumn
(
id
)}
getSearchColumnIdSet
=
lazyMethod
(
getSearchColumnIdSet
)
...
...
@@ -1020,10 +1015,8 @@ class ListBoxRenderer:
"""
sort_columns
=
self
.
field
.
get_value
(
'sort_columns'
)
if
sort_columns
:
sort_column_id_set
=
set
([
c
[
0
]
for
c
in
sort_columns
])
else
:
sort_column_id_set
=
self
.
getSearchColumnIdSet
()
return
sort_column_id_set
return
{
c
[
0
]
for
c
in
sort_columns
}
return
self
.
getSearchColumnIdSet
()
getSortColumnIdSet
=
lazyMethod
(
getSortColumnIdSet
)
...
...
@@ -1031,7 +1024,7 @@ class ListBoxRenderer:
"""Return the set of the ids of the editable columns.
"""
editable_columns
=
self
.
field
.
get_value
(
'editable_columns'
)
return
set
([
c
[
0
]
for
c
in
editable_columns
])
return
{
c
[
0
]
for
c
in
editable_columns
}
getEditableColumnIdSet
=
lazyMethod
(
getEditableColumnIdSet
)
...
...
@@ -1309,7 +1302,7 @@ class ListBoxRenderer:
field
=
self
.
field
original_field_id
=
field
.
id
while
True
:
for
field_id
in
set
((
original_field_id
,
field
.
id
))
:
for
field_id
in
{
original_field_id
,
field
.
id
}
:
if
field
.
aq_parent
.
has_field
(
"%s_%s"
%
(
field_id
,
alias
),
include_disabled
=
1
):
return
field
.
aq_parent
.
get_field
(
"%s_%s"
%
(
field_id
,
alias
),
include_disabled
=
1
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Form/Tool/SelectionTool.py
View file @
daffb775
...
...
@@ -1511,7 +1511,7 @@ class SelectionTool( BaseTool, SimpleItem ):
def
_getSelectionNameListFromContainer
(
self
):
user_id
=
self
.
_getUserId
()
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
\
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
self
.
getTemporarySelectionDict
().
keys
()))
def
isAnonymous
(
self
):
...
...
This diff is collapsed.
Click to expand it.
product/ERP5OOo/tests/testDms.py
View file @
daffb775
...
...
@@ -169,8 +169,8 @@ class TestDocumentMixin(ERP5TypeTestCase):
self
.
abort
()
self
.
clearRestrictedSecurityHelperScript
()
activity_tool
=
self
.
portal
.
portal_activities
activity_status
=
set
(
m
.
processing_node
<
-
1
for
m
in
activity_tool
.
getMessageList
())
activity_status
=
{
m
.
processing_node
<
-
1
for
m
in
activity_tool
.
getMessageList
()}
if
True
in
activity_status
:
activity_tool
.
manageClearActivities
()
else
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5OOo/tests/testIngestion.py
View file @
daffb775
...
...
@@ -114,8 +114,8 @@ class TestIngestion(ERP5TypeTestCase):
module
.
manage_delObjects
([
id
for
id
in
module
.
objectIds
()])
self
.
tic
()
activity_tool
=
self
.
portal
.
portal_activities
activity_status
=
set
(
m
.
processing_node
<
-
1
for
m
in
activity_tool
.
getMessageList
())
activity_status
=
{
m
.
processing_node
<
-
1
for
m
in
activity_tool
.
getMessageList
()}
if
True
in
activity_status
:
activity_tool
.
manageClearActivities
()
else
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5OOo/tests/testOOoImport.py
View file @
daffb775
...
...
@@ -876,9 +876,8 @@ class TestOOoImport(TestOOoImportMixin):
import_file
=
makeFileUpload
(
'import_category_with_reserved_id_in_id.sxc'
),
invalid_spreadsheet_error_handler
=
on_invalid_spreadsheet
)
self
.
assertEquals
(
message_set
,
set
([
"The ID source_title in region at line 2 is invalid, "
self
.
assertEqual
(
message_set
,
{
"The ID source_title in region at line 2 is invalid, "
"it's a reserved property name"
,
"The ID source_title in region at line 4 is invalid, "
"it's a reserved property name"
,
...
...
@@ -887,7 +886,7 @@ class TestOOoImport(TestOOoImportMixin):
"The ID fallback_base_category_list in region at line 6 is invalid, "
"it's a reserved property name"
,
"The ID default_source_reference in region at line 7 is invalid, "
"it's a reserved property name"
])
)
"it's a reserved property name"
}
)
def
test_BigSpreadSheet_can_be_parsed
(
self
,):
"""Test than OOoimport can parse a file with more than 40000 lines
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Security/tests/testERP5Security.py
View file @
daffb775
...
...
@@ -222,9 +222,8 @@ class TestUserManagement(ERP5TypeTestCase):
def
test_searchUsers
(
self
):
p1
=
self
.
_makePerson
(
reference
=
'person1'
)
p2
=
self
.
_makePerson
(
reference
=
'person2'
)
self
.
assertEqual
(
set
([
'person1'
,
'person2'
]),
set
([
x
[
'userid'
]
for
x
in
self
.
portal
.
acl_users
.
searchUsers
(
id
=
'person'
)]))
self
.
assertEqual
({
'person1'
,
'person2'
},
{
x
[
'userid'
]
for
x
in
self
.
portal
.
acl_users
.
searchUsers
(
id
=
'person'
)})
def
test_searchUsersExactMatch
(
self
):
p
=
self
.
_makePerson
(
reference
=
'person'
)
...
...
@@ -595,7 +594,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
obj
=
self
.
_makeOne
()
self
.
assertEqual
([
'Assignor'
],
obj
.
__ac_local_roles__
.
get
(
'F1_G1_S1'
))
self
.
assertTrue
(
'Assignor'
in
user
.
getRolesInContext
(
obj
))
self
.
assertEqual
(
set
([(
'F1_G1_S1'
,
'Assignor'
)])
,
self
.
assertEqual
(
{(
'F1_G1_S1'
,
'Assignor'
)}
,
obj
.
__ac_local_roles_group_id_dict__
.
get
(
'Alternate'
))
self
.
abort
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/Accessor/Value.py
View file @
daffb775
...
...
@@ -190,7 +190,7 @@ def defMethodGetter(key, method=None):
name
=
'%sSetGetter'
%
key
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
r
=
ListGetter
.
__call__
(
self
,
instance
,
**
kw
)
return
list
(
set
(
method
(
x
)
for
x
in
r
)
)
if
r
or
not
args
else
args
[
0
]
return
list
(
{
method
(
x
)
for
x
in
r
}
)
if
r
or
not
args
else
args
[
0
]
psyco
.
bind
(
__call__
)
globals
()[
name
]
=
type
(
name
,
(
ListGetter
,),
{
'__call__'
:
__call__
})
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/Base.py
View file @
daffb775
...
...
@@ -348,10 +348,9 @@ def _aq_reset():
class
PropertyHolder
(
object
):
isRADContent
=
1
WORKFLOW_METHOD_MARKER
=
(
'Base._doNothing'
,)
RESERVED_PROPERTY_SET
=
set
((
'_constraints'
,
'_properties'
,
'_categories'
,
'__implements__'
,
'property_sheets'
,
'__ac_permissions__'
,
'_erp5_properties'
))
RESERVED_PROPERTY_SET
=
{
'_constraints'
,
'_properties'
,
'_categories'
,
'__implements__'
,
'property_sheets'
,
'__ac_permissions__'
,
'_erp5_properties'
}
def
__init__
(
self
,
name
=
'PropertyHolder'
):
self
.
__name__
=
name
...
...
@@ -1419,17 +1418,17 @@ class Base( CopyContainer,
unordered_key_list
=
[
k
for
k
in
key_list
if
k
not
in
edit_order
]
ordered_key_list
=
[
k
for
k
in
edit_order
if
k
in
key_list
]
restricted_method_set
=
set
()
default_permission_set
=
set
((
'Access contents information'
,
'Modify portal content'
))
if
restricted
:
# retrieve list of accessors which doesn't use default permissions
for
ancestor
in
self
.
__class__
.
mro
():
for
permissions
in
getattr
(
ancestor
,
'__ac_permissions__'
,
()):
if
permissions
[
0
]
not
in
default_permission_set
:
for
method
in
permissions
[
1
]:
if
method
.
startswith
(
'set'
):
restricted_method_set
.
add
(
method
)
restricted_method_set
=
{
method
for
ancestor
in
self
.
__class__
.
mro
()
for
permissions
in
getattr
(
ancestor
,
'__ac_permissions__'
,
())
if
permissions
[
0
]
not
in
(
'Access contents information'
,
'Modify portal content'
)
for
method
in
permissions
[
1
]
if
method
.
startswith
(
'set'
)}
else
:
restricted_method_set
=
()
getProperty
=
self
.
getProperty
hasProperty
=
self
.
hasProperty
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/CodingStyle.py
View file @
daffb775
...
...
@@ -82,8 +82,7 @@ def getSkinPrefixList(self):
'Form'
,
# Acceptable for ERP5 Forms which will soon become portal types too
))
skin_prefix_list
=
set
(
skin_prefix_list
)
return
skin_prefix_list
return
set
(
skin_prefix_list
)
# Generic method to check consistency of a skin item
def
checkConsistency
(
self
,
fixit
=
0
,
source_code
=
None
):
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/Core/Predicate.py
View file @
daffb775
...
...
@@ -225,33 +225,29 @@ class Predicate(XMLObject):
# BBB: accessor is not present on old Predicate property sheet.
if
criterion_list
or
getattr
(
self
,
'isEmptyPredicateValid'
,
lambda
:
True
)():
for
criterion
in
criterion_list
:
if
criterion
.
min
and
criterion
.
max
:
catalog_kw
[
criterion
.
property
]
=
{
'query'
:
(
criterion
.
min
,
criterion
.
max
),
'range'
:
'minmax'
}
elif
criterion
.
min
:
catalog_kw
[
criterion
.
property
]
=
{
'query'
:
criterion
.
min
,
'range'
:
'min'
}
p
=
criterion
.
property
if
criterion
.
min
:
if
criterion
.
max
:
catalog_kw
[
p
]
=
{
'query'
:
(
criterion
.
min
,
criterion
.
max
),
'range'
:
'minmax'
}
else
:
catalog_kw
[
p
]
=
{
'query'
:
criterion
.
min
,
'range'
:
'min'
}
elif
criterion
.
max
:
catalog_kw
[
criterion
.
property
]
=
{
'query'
:
criterion
.
max
,
'range'
:
'max'
}
catalog_kw
[
p
]
=
{
'query'
:
criterion
.
max
,
'range'
:
'max'
}
else
:
# if a filter was passed as argument
if
catalog_kw
.
has_key
(
criterion
.
property
):
if
isinstance
(
catalog_kw
[
criterion
.
property
],
(
tuple
,
list
)):
catalog_filter_set
=
set
(
catalog_kw
[
criterion
.
property
])
else
:
catalog_filter_set
=
set
([
catalog_kw
[
criterion
.
property
]])
if
isinstance
(
criterion
.
identity
,
(
tuple
,
list
)):
parameter_filter_set
=
set
(
criterion
.
identity
)
else
:
parameter_filter_set
=
set
([
criterion
.
identity
])
catalog_kw
[
criterion
.
property
]
=
\
list
(
catalog_filter_set
.
intersection
(
parameter_filter_set
))
try
:
f
=
catalog_kw
[
p
]
except
KeyError
:
catalog_kw
[
p
]
=
criterion
.
identity
else
:
catalog_kw
[
criterion
.
property
]
=
criterion
.
identity
f
=
set
(
f
)
if
isinstance
(
f
,
(
tuple
,
list
))
else
{
f
}
i
=
criterion
.
identity
if
isinstance
(
i
,
(
tuple
,
list
)):
f
.
intersection_update
(
i
)
else
:
f
=
(
i
,)
if
i
in
f
else
()
catalog_kw
[
p
]
=
list
(
f
)
else
:
# By catalog definition, no object has uid 0, so this condition forces an
# empty result.
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/ERP5Type.py
View file @
daffb775
...
...
@@ -656,8 +656,8 @@ class ERP5TypeInformation(XMLObject,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailablePropertySheetList'
)
def
getAvailablePropertySheetList
(
self
):
property_sheet_set
=
set
([
k
for
k
in
PropertySheet
.
__dict__
if
not
k
.
startswith
(
'_'
)])
property_sheet_set
=
{
k
for
k
in
PropertySheet
.
__dict__
if
not
k
.
startswith
(
'_'
)}
property_sheet_tool
=
self
.
getPortalObject
().
portal_property_sheets
property_sheet_set
.
update
(
property_sheet_tool
.
objectIds
())
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/Tool/PropertySheetTool.py
View file @
daffb775
...
...
@@ -151,8 +151,8 @@ class PropertySheetTool(BaseTool):
'templates to have fixed version of these property sheets: '
\
'$business_templates'
mapping
[
'failed_import'
]
=
', '
.
join
(
failed_import
)
mapping
[
'business_templates'
]
=
', '
.
join
(
set
(
KNOWN_BROKEN_PROPERTY_SHEET_DICT
[
x
]
for
x
in
failed_import
)
)
mapping
[
'business_templates'
]
=
', '
.
join
(
{
KNOWN_BROKEN_PROPERTY_SHEET_DICT
[
x
]
for
x
in
failed_import
}
)
message
=
portal
.
Base_translateString
(
base_message
,
mapping
=
mapping
)
return
self
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
message
})
...
...
@@ -164,5 +164,5 @@ class PropertySheetTool(BaseTool):
Return a sorted set of all the permissions useful for read/write
permissions for properties of ZODB Property Sheets
"""
return
sorted
(
set
([
value
for
key
,
value
in
Permissions
.
__dict__
.
iteritems
()
\
if
key
[
0
].
isupper
()
])
)
return
sorted
(
{
value
for
key
,
value
in
Permissions
.
__dict__
.
iteritems
()
if
key
[
0
].
isupper
()}
)
This diff is collapsed.
Click to expand it.
product/ERP5Type/XMLUtils.py
View file @
daffb775
...
...
@@ -60,10 +60,10 @@ def parseStream(stream, child_discard_set, callback_dict, catchall=None):
"""
if
catchall
is
None
:
catchall
=
lambda
x
:
None
callback_set
=
set
(
callback_set
=
{
y
for
x
,
y
in
callback_dict
if
x
in
(
'start'
,
'end'
,
None
)
# None is equivalent to 'end'
)
}
else
:
callback_set
=
INFINITE_SET
def
elementFactory
(
tag
,
attrs
):
...
...
@@ -72,7 +72,7 @@ def parseStream(stream, child_discard_set, callback_dict, catchall=None):
return
RestrictedElement
(
tag
,
attrs
)
for
event
,
elem
in
iterparse
(
stream
,
events
=
set
([
x
for
x
,
_
in
callback_dict
.
iterkeys
()])
,
events
=
{
x
for
x
,
_
in
callback_dict
}
,
parser
=
XMLParser
(
target
=
TreeBuilder
(
element_factory
=
elementFactory
,
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/dynamic/accessor_holder.py
View file @
daffb775
...
...
@@ -369,8 +369,8 @@ def createAllAccessorHolderList(site,
if
portal_type
is
not
None
:
accessor_holder_list
.
extend
(
portal_type
.
getAccessorHolderList
())
portal_type_property_sheet_name_set
=
set
(
[
accessor_holder
.
__name__
for
accessor_holder
in
accessor_holder_list
])
portal_type_property_sheet_name_set
=
{
accessor_holder
.
__name__
for
accessor_holder
in
accessor_holder_list
}
else
:
portal_type_property_sheet_name_set
=
set
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/dynamic/persistent_migration.py
View file @
daffb775
...
...
@@ -84,7 +84,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
connection
.
_db
.
classFactory
)
ObjectWriter
.
__init__
(
self
,
obj
)
migrated_oid_set
=
set
()
oid_set
=
set
((
obj
.
_p_oid
,))
oid_set
=
{
obj
.
_p_oid
}
while
oid_set
:
oid
=
oid_set
.
pop
()
obj
=
ObjectReader
.
load_oid
(
self
,
oid
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/patches/DA.py
View file @
daffb775
...
...
@@ -298,7 +298,7 @@ def DA_upgradeSchema(self, connection_id=None, src__=0):
q(new_default)
old_dict = {}
new =
set(column[0] for column in new_list)
new =
{column[0] for column in new_list}
for pos, (column, spec) in enumerate(old_list):
if column in new:
old_dict[column] = pos, spec
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/patches/WorkflowTool.py
View file @
daffb775
...
...
@@ -493,10 +493,10 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
use_cache
=
search_result
is
not
None
if
use_cache
:
ignored_security_column_id_set
=
self
.
_getWorklistIgnoredSecurityColumnSet
()
ignored_security_uid_parameter_set
=
set
(
x
ignored_security_uid_parameter_set
=
{
x
for
x
,
y
in
catalog_security_uid_groups_columns_dict
.
iteritems
()
if
y
in
ignored_security_column_id_set
)
}
_getSecurityUidDictAndRoleColumnDict
=
getSecurityUidDictAndRoleColumnDict
def
getSecurityUidDictAndRoleColumnDict
(
**
kw
):
security_uid_dict
,
role_column_dict
,
local_role_column_dict
=
\
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
daffb775
...
...
@@ -498,15 +498,13 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
bt_set
=
set
(
searchable_business_template_list
).
difference
(
x
[
'title'
]
for
x
in
template_tool
.
repository_dict
.
itervalues
()
for
x
in
x
)
if
bt_set
:
template_tool
.
updateRepositoryBusinessTemplateList
(
set
(
os
.
path
.
dirname
(
x
[
0
])
for
x
in
self
.
_getBTPathAndIdList
(
bt_set
))
,
template_tool
.
updateRepositoryBusinessTemplateList
(
{
os
.
path
.
dirname
(
x
[
0
])
for
x
in
self
.
_getBTPathAndIdList
(
bt_set
)}
,
genbt5list
=
1
)
def
failIfDifferentSet
(
self
,
a
,
b
,
msg
=
""
):
if
not
msg
:
msg
=
'%r != %r'
%
(
a
,
b
)
self
.
assertEqual
(
set
(
a
),
set
(
b
),
msg
)
assertSameSet
=
failIfDifferentSet
def
assertSameSet
(
self
,
a
,
b
,
msg
=
None
):
self
.
assertSetEqual
(
set
(
a
),
set
(
b
),
msg
)
failIfDifferentSet
=
assertSameSet
def
assertHasAttribute
(
self
,
obj
,
attribute
,
msg
=
None
):
self
.
assertNotEqual
(
None
,
getattr
(
obj
,
attribute
,
None
),
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
daffb775
...
...
@@ -234,8 +234,8 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
message_count
=
len
(
message_list
)
# This prevents an infinite loop.
count
-=
1
if
count
==
0
or
(
message_count
and
set
([
x
.
processing_node
for
x
in
message_list
]).
issubset
(
set
([
-
2
,
-
3
]))
):
if
not
count
or
message_count
and
all
(
x
.
processing_node
==
-
2
for
x
in
message_list
):
# We're about to raise RuntimeError, but maybe we've reached
# the stop condition, so check just once more:
if
stop_condition
(
message_list
):
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/runUnitTest.py
View file @
daffb775
...
...
@@ -402,8 +402,8 @@ class ERP5TypeTestLoader(unittest.TestLoader):
bt5_path
=
os
.
environ
.
get
(
'erp5_tests_bt5_path'
)
if
bt5_path
:
bt5_path_list
.
extend
(
set
([
re
.
sub
(
"(
\
/
\
*|
\
*)
"
, '', bt5_path)
for bt5_path in bt5_path.split(',')]))
bt5_path_list
+=
{
re
.
sub
(
"(
\
/
\
*|
\
*)
"
, '', bt5_path)
for bt5_path in bt5_path.split(',')}
else:
from App.config import getConfiguration
instancehome = getConfiguration().instancehome
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/testERP5Type.py
View file @
daffb775
...
...
@@ -2015,21 +2015,21 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
# Check getCategorySet accessor
foo
.
setDefaultRegionValue
(
beta
)
self
.
assertSameSet
(
set
([
beta_path
])
,
foo
.
getRegionSet
())
self
.
assertSameSet
(
{
beta_path
}
,
foo
.
getRegionSet
())
self
.
assertSameSet
(
set
(),
foo
.
getRegionSet
(
checked_permission
=
checked_permission
))
# Check getCategoryIdSet accessor
foo
.
setDefaultRegionValue
(
beta
)
self
.
assertSameSet
(
set
([
beta_id
])
,
foo
.
getRegionIdSet
())
self
.
assertSameSet
(
{
beta_id
}
,
foo
.
getRegionIdSet
())
self
.
assertSameSet
(
set
(),
foo
.
getRegionIdSet
(
checked_permission
=
checked_permission
))
# Check getCategoryTitleSet accessor
foo
.
setDefaultRegionValue
(
beta
)
self
.
assertSameSet
(
set
([
beta_title
])
,
foo
.
getRegionTitleSet
())
self
.
assertSameSet
(
{
beta_title
}
,
foo
.
getRegionTitleSet
())
self
.
assertSameSet
(
set
(),
foo
.
getRegionTitleSet
(
...
...
@@ -2037,7 +2037,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
# Check getCategoryValueSet accessor
foo
.
setDefaultRegionValue
(
beta
)
self
.
assertSameSet
(
set
([
beta
])
,
foo
.
getRegionValueSet
())
self
.
assertSameSet
(
{
beta
}
,
foo
.
getRegionValueSet
())
self
.
assertSameSet
(
set
(),
foo
.
getRegionValueSet
(
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/utils.py
View file @
daffb775
...
...
@@ -626,10 +626,10 @@ class SubcontentReindexingWrapper(object):
catalogged_object_path_set
.
add
(
q
.
getPath
())
return
orig_catalogObjectList
(
self
,
object_list
,
*
args
,
**
kw
)
orig_catalogObjectList
=
Catalog
.
__dict__
[
'catalogObjectList'
]
expected_path_set
=
set
(
q
.
getPath
()
for
q
in
children_document_list
+
[
parent_document
]
)
self
.
assertEqual
(
expected_path_set
,
set
(
x
.
getPath
()
for
x
in
self
.
portal
.
portal_catalog
(
path
=
expected_path_set
)
)
)
expected_path_set
=
{
q
.
getPath
()
for
q
in
children_document_list
+
[
parent_document
]
}
self
.
assertEqual
(
expected_path_set
,
{
x
.
getPath
()
for
x
in
self
.
portal
.
portal_catalog
(
path
=
expected_path_set
)
}
)
try
:
Catalog
.
catalogObjectList
=
catalogObjectList
catalogged_object_path_set
=
set
()
...
...
This diff is collapsed.
Click to expand it.
product/ZSQLCatalog/SQLCatalog.py
View file @
daffb775
...
...
@@ -912,7 +912,7 @@ class Catalog(Folder,
# Get subject information
# XXX if more collation is available, we can have smaller number of
# unique subject sets.
subject_list
=
tuple
(
sorted
(
set
([(
x
or
''
).
lower
()
for
x
in
getSubjectList
()])
))
subject_list
=
tuple
(
sorted
(
{(
x
or
''
).
lower
()
for
x
in
getSubjectList
()}
))
if
not
subject_list
:
return
(
None
,
None
)
# Make sure no duplicates
...
...
@@ -2468,12 +2468,11 @@ class Catalog(Folder,
"""
return
getComparisonOperatorInstance
(
operator
)
PROPAGATE_PARAMETER_SET
=
set
([
'selection_domain'
,
'selection_report'
,
# XXX should get the next parameters from
# the ZSQLMethod class itself
'zsql_brain'
,
])
PROPAGATE_PARAMETER_SET
=
(
'selection_domain'
,
'selection_report'
,
# XXX should get the next parameters from
# the ZSQLMethod class itself
'zsql_brain'
)
def
_queryResults
(
self
,
REQUEST
=
None
,
build_sql_query_method
=
None
,
**
kw
):
""" Returns a list of brains from a set of constraints on variables """
if
build_sql_query_method
is
None
:
...
...
@@ -2484,10 +2483,8 @@ class Catalog(Folder,
ENFORCE_SEPARATION
=
True
if
ENFORCE_SEPARATION
:
# Some parameters must be propagated:
new_kw
=
dict
((
name
,
kw
[
name
])
for
name
in
self
.
PROPAGATE_PARAMETER_SET
&
set
(
kw
))
# discard all others:
kw
=
new_kw
kw
=
{
name
:
kw
[
name
]
for
name
in
self
.
PROPAGATE_PARAMETER_SET
if
name
in
kw
}
kw
[
'where_expression'
]
=
query
[
'where_expression'
]
kw
[
'sort_on'
]
=
query
[
'order_by_expression'
]
kw
[
'from_table_list'
]
=
query
[
'from_table_list'
]
...
...
This diff is collapsed.
Click to expand it.
product/ZSQLCatalog/SQLExpression.py
View file @
daffb775
...
...
@@ -191,11 +191,11 @@ class SQLExpression(object):
ValueError.
"""
result
=
self
.
order_by_list
[:]
known_column_set
=
set
([
x
[
0
]
for
x
in
result
])
known_column_set
=
{
x
[
0
]
for
x
in
result
}
for
sql_expression
in
self
.
sql_expression_list
:
for
order_by
in
sql_expression
.
getOrderByList
():
if
order_by
[
0
]
in
known_column_set
:
raise
ValueError
,
'I don
\
'
t know how to merge order_by yet'
raise
ValueError
(
"I don't know how to merge order_by yet"
)
else
:
result
.
append
(
order_by
)
known_column_set
.
add
(
order_by
[
0
])
...
...
This diff is collapsed.
Click to expand it.
product/ZSQLCatalog/SearchText/SearchTextParser.py
View file @
daffb775
...
...
@@ -287,7 +287,7 @@ if __name__ == '__main__':
return
result
original_parse
=
parse
fake_column_id_set
=
set
([
'a'
,
'b'
,
'c'
,
'd'
,
'title'
,
'toto'
,
'titi'
,
'foo'
,
'bar'
])
fake_column_id_set
=
{
'a'
,
'b'
,
'c'
,
'd'
,
'title'
,
'toto'
,
'titi'
,
'foo'
,
'bar'
}
def
isColumn
(
value
):
return
value
in
fake_column_id_set
...
...
This diff is collapsed.
Click to expand it.
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