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
Eugene Shen
erp5
Commits
23d7bdd2
Commit
23d7bdd2
authored
Oct 13, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: use new syntax (from Python 2.7) for dict comprehensions
parent
daffb775
Changes
38
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
120 additions
and
161 deletions
+120
-161
product/ERP5/Document/AppliedRule.py
product/ERP5/Document/AppliedRule.py
+1
-1
product/ERP5/Document/BudgetLine.py
product/ERP5/Document/BudgetLine.py
+2
-2
product/ERP5/Document/PaySheetTransaction.py
product/ERP5/Document/PaySheetTransaction.py
+8
-8
product/ERP5/Document/Resource.py
product/ERP5/Document/Resource.py
+4
-6
product/ERP5/Document/RoleDefinition.py
product/ERP5/Document/RoleDefinition.py
+2
-2
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
...ct/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
+2
-2
product/ERP5/Document/TradeModelSimulationRule.py
product/ERP5/Document/TradeModelSimulationRule.py
+2
-2
product/ERP5/Document/VariationEquivalenceTester.py
product/ERP5/Document/VariationEquivalenceTester.py
+3
-3
product/ERP5/ExplanationCache.py
product/ERP5/ExplanationCache.py
+1
-1
product/ERP5/Tool/TaskDistributionTool.py
product/ERP5/Tool/TaskDistributionTool.py
+2
-2
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+2
-2
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+3
-7
product/ERP5/tests/testAmount.py
product/ERP5/tests/testAmount.py
+1
-2
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+1
-1
product/ERP5/tests/testTemplateTool.py
product/ERP5/tests/testTemplateTool.py
+18
-17
product/ERP5/tests/testTradeModelLine.py
product/ERP5/tests/testTradeModelLine.py
+4
-4
product/ERP5/tests/testTranslation.py
product/ERP5/tests/testTranslation.py
+2
-2
product/ERP5/tests/testWorklist.py
product/ERP5/tests/testWorklist.py
+2
-2
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+2
-3
product/ERP5Configurator/Document/WorkflowSecurityConfiguratorItem.py
...Configurator/Document/WorkflowSecurityConfiguratorItem.py
+1
-1
product/ERP5Form/MultiRelationField.py
product/ERP5Form/MultiRelationField.py
+6
-14
product/ERP5Form/ParallelListField.py
product/ERP5Form/ParallelListField.py
+6
-14
product/ERP5Form/Selection.py
product/ERP5Form/Selection.py
+4
-3
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
+4
-9
product/ERP5Type/Accessor/Acquired.py
product/ERP5Type/Accessor/Acquired.py
+1
-4
product/ERP5Type/Accessor/Category.py
product/ERP5Type/Accessor/Category.py
+1
-3
product/ERP5Type/Accessor/Related.py
product/ERP5Type/Accessor/Related.py
+1
-3
product/ERP5Type/Accessor/RelatedValue.py
product/ERP5Type/Accessor/RelatedValue.py
+2
-6
product/ERP5Type/Core/AcquiredProperty.py
product/ERP5Type/Core/AcquiredProperty.py
+4
-3
product/ERP5Type/Tool/TypesTool.py
product/ERP5Type/Tool/TypesTool.py
+3
-3
product/ERP5Type/TranslationProviderBase.py
product/ERP5Type/TranslationProviderBase.py
+1
-2
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+10
-8
product/ERP5Type/patches/DCWorkflow.py
product/ERP5Type/patches/DCWorkflow.py
+2
-2
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+3
-3
product/ERP5VCS/Subversion.py
product/ERP5VCS/Subversion.py
+2
-2
product/ERP5VCS/SubversionClient.py
product/ERP5VCS/SubversionClient.py
+1
-2
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+4
-7
product/ZSQLCatalog/SearchKey/RelatedKey.py
product/ZSQLCatalog/SearchKey/RelatedKey.py
+2
-3
No files found.
product/ERP5/Document/AppliedRule.py
View file @
23d7bdd2
...
@@ -369,7 +369,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -369,7 +369,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
del
AppliedRule
.
isIndexable
,
SimulationMovement
.
isIndexable
del
AppliedRule
.
isIndexable
,
SimulationMovement
.
isIndexable
self
.
recursiveReindexObject
()
self
.
recursiveReindexObject
()
assert
str
not
in
map
(
type
,
old_dict
),
old_dict
assert
str
not
in
map
(
type
,
old_dict
),
old_dict
return
dict
((
k
,
sum
(
v
.
values
(),
[]))
for
k
,
v
in
deleted
)
,
delivery_set
return
{
k
:
sum
(
v
.
values
(),
[])
for
k
,
v
in
deleted
}
,
delivery_set
simulation_tool
.
_delObject
(
self
.
getId
())
simulation_tool
.
_delObject
(
self
.
getId
())
def
_checkExpand
(
self
):
def
_checkExpand
(
self
):
...
...
product/ERP5/Document/BudgetLine.py
View file @
23d7bdd2
...
@@ -90,8 +90,8 @@ class BudgetLine(Predicate, XMLMatrix, VariatedMixin):
...
@@ -90,8 +90,8 @@ class BudgetLine(Predicate, XMLMatrix, VariatedMixin):
"""Returns all the engagements in a dict where the keys are the cells, and
"""Returns all the engagements in a dict where the keys are the cells, and
the value is the engaged budget.
the value is the engaged budget.
"""
"""
budget_dict
=
dict
([(
k
,
v
*
-
1
)
for
(
k
,
v
)
in
budget_dict
=
{
k
:
v
*
-
1
self
.
getEngagedBudgetDict
(
**
kw
).
items
()])
for
k
,
v
in
self
.
getEngagedBudgetDict
(
**
kw
).
iteritems
()}
cell_key_list
=
self
.
getCellKeyList
()
cell_key_list
=
self
.
getCellKeyList
()
for
cell_key
in
cell_key_list
:
for
cell_key
in
cell_key_list
:
...
...
product/ERP5/Document/PaySheetTransaction.py
View file @
23d7bdd2
...
@@ -150,10 +150,10 @@ class PaySheetTransaction(Invoice):
...
@@ -150,10 +150,10 @@ class PaySheetTransaction(Invoice):
security
.
declarePrivate
(
'updateAggregatedAmountList'
)
security
.
declarePrivate
(
'updateAggregatedAmountList'
)
def
updateAggregatedAmountList
(
self
,
*
args
,
**
kw
):
def
updateAggregatedAmountList
(
self
,
*
args
,
**
kw
):
amount_dict
=
dict
((
(
x
.
getReference
(),
amount_dict
=
{
(
x
.
getReference
(),
tuple
(
x
.
getVariationCategoryList
())),
x
)
tuple
(
x
.
getVariationCategoryList
())):
x
for
x
in
self
.
getAggregatedAmountList
(
*
args
,
**
kw
)
for
x
in
self
.
getAggregatedAmountList
(
*
args
,
**
kw
)
if
x
.
getResource
())
if
x
.
getResource
()}
movement_to_delete_list
=
[]
movement_to_delete_list
=
[]
for
movement
in
self
.
getMovementList
():
for
movement
in
self
.
getMovementList
():
if
movement
.
getBaseApplication
():
if
movement
.
getBaseApplication
():
...
@@ -163,9 +163,9 @@ class PaySheetTransaction(Invoice):
...
@@ -163,9 +163,9 @@ class PaySheetTransaction(Invoice):
if
amount
is
None
:
if
amount
is
None
:
movement_to_delete_list
.
append
(
movement
)
movement_to_delete_list
.
append
(
movement
)
else
:
else
:
movement
.
edit
(
**
dict
((
x
,
amount
.
getProperty
(
x
)
)
movement
.
edit
(
**
{
x
:
amount
.
getProperty
(
x
)
for
x
in
(
'price'
,
'resource'
,
'quantity'
,
for
x
in
(
'price'
,
'resource'
,
'quantity'
,
'base_application_list'
,
'base_contribution_list'
)
)
)
'base_application_list'
,
'base_contribution_list'
)
}
)
return
{
'movement_to_delete_list'
:
movement_to_delete_list
,
return
{
'movement_to_delete_list'
:
movement_to_delete_list
,
'movement_to_add_list'
:
amount_dict
.
values
()}
'movement_to_add_list'
:
amount_dict
.
values
()}
...
@@ -208,8 +208,8 @@ class PaySheetTransaction(Invoice):
...
@@ -208,8 +208,8 @@ class PaySheetTransaction(Invoice):
# convert Amount into Simulation Movement with Business Link
# convert Amount into Simulation Movement with Business Link
movement_list
=
[]
movement_list
=
[]
for
amount
in
movement_list_trade_phase_dic
[
trade_phase
]:
for
amount
in
movement_list_trade_phase_dic
[
trade_phase
]:
variation_dict
=
dict
(
variation_dict
=
dict
(
x
.
split
(
'/'
,
1
)
[
tuple
(
x
.
split
(
'/'
,
1
))
for
x
in
amount
.
getVariationCategoryList
()]
)
for
x
in
amount
.
getVariationCategoryList
()
)
movement_list
.
extend
(
movement_list
.
extend
(
business_process
.
getTradePhaseMovementList
(
business_process
.
getTradePhaseMovementList
(
self
,
amount
,
trade_phase
,
update_property_dict
=
variation_dict
))
self
,
amount
,
trade_phase
,
update_property_dict
=
variation_dict
))
...
...
product/ERP5/Document/Resource.py
View file @
23d7bdd2
...
@@ -119,14 +119,14 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
...
@@ -119,14 +119,14 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
sort_on
=
[(
'title'
,
'ascending'
)])
sort_on
=
[(
'title'
,
'ascending'
)])
individual_variation_list
=
[
x
.
getObject
()
for
x
in
individual_variation_list
=
[
x
.
getObject
()
for
x
in
individual_variation_list
]
individual_variation_list
]
other_base_category_
dict
=
dict
([(
i
,
1
)
for
i
in
base_category_list
]
)
other_base_category_
set
=
set
(
base_category_list
)
if
not
omit_individual_variation
:
if
not
omit_individual_variation
:
for
variation
in
individual_variation_list
:
for
variation
in
individual_variation_list
:
for
base_category
in
variation
.
getVariationBaseCategoryList
():
for
base_category
in
variation
.
getVariationBaseCategoryList
():
if
base_category_list
is
()
\
if
base_category_list
is
()
\
or
base_category
in
base_category_list
:
or
base_category
in
base_category_list
:
other_base_category_
dict
[
base_category
]
=
0
other_base_category_
set
.
discard
(
base_category
)
# XXX now, call Renderer a lot of time.
# XXX now, call Renderer a lot of time.
# Better implementation needed
# Better implementation needed
result
.
extend
(
Renderer
(
result
.
extend
(
Renderer
(
...
@@ -136,12 +136,10 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
...
@@ -136,12 +136,10 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
current_category
=
current_category
,
current_category
=
current_category
,
display_id
=
display_id
).
render
([
variation
]))
display_id
=
display_id
).
render
([
variation
]))
other_base_category_list
=
[
x
for
x
,
y
in
other_base_category_dict
.
iteritems
()
if
y
==
1
]
# Get category variation
# Get category variation
if
other_base_category_
lis
t
:
if
other_base_category_
se
t
:
result
.
extend
(
super
(
Resource
,
self
).
getVariationRangeCategoryItemList
(
result
.
extend
(
super
(
Resource
,
self
).
getVariationRangeCategoryItemList
(
base_category_list
=
other_base_category_list
,
base_category_list
=
list
(
other_base_category_set
)
,
base
=
base
,
display_base_category
=
display_base_category
,
**
kw
))
base
=
base
,
display_base_category
=
display_base_category
,
**
kw
))
# Return result
# Return result
return
result
return
result
...
...
product/ERP5/Document/RoleDefinition.py
View file @
23d7bdd2
...
@@ -63,6 +63,6 @@ class RoleDefinition(XMLObject):
...
@@ -63,6 +63,6 @@ class RoleDefinition(XMLObject):
group_id_generator
=
getattr
(
ob
,
group_id_generator
=
getattr
(
ob
,
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
)
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
)
role_list
=
self
.
getRoleName
(),
role_list
=
self
.
getRoleName
(),
return
dict
((
group_id
,
role_list
)
return
{
group_id
:
role_list
for
group_id
in
group_id_generator
(
category_order
=
(
'agent'
,),
for
group_id
in
group_id_generator
(
category_order
=
(
'agent'
,),
agent
=
self
.
getAgentList
())
)
agent
=
self
.
getAgentList
())
}
product/ERP5/Document/SQLNonContinuousIncreasingIdGenerator.py
View file @
23d7bdd2
...
@@ -236,8 +236,8 @@ class SQLNonContinuousIncreasingIdGenerator(IdGenerator):
...
@@ -236,8 +236,8 @@ class SQLNonContinuousIncreasingIdGenerator(IdGenerator):
if
self
.
getStoredInZodb
():
if
self
.
getStoredInZodb
():
self
.
_updateSqlTable
()
self
.
_updateSqlTable
()
# Return values from sql
# Return values from sql
return
dict
([(
line
[
'id_group'
],
int
(
line
[
'last_id'
]))
for
line
in
return
{
line
[
'id_group'
]:
int
(
line
[
'last_id'
])
self
.
_getValueListFromTable
()])
for
line
in
self
.
_getValueListFromTable
()}
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'importGeneratorIdDict'
)
'importGeneratorIdDict'
)
...
...
product/ERP5/Document/TradeModelSimulationRule.py
View file @
23d7bdd2
...
@@ -100,9 +100,9 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
...
@@ -100,9 +100,9 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
if
amount
.
getResource
():
if
amount
.
getResource
():
# FIXME: Is it the right way to have source/destination and other
# FIXME: Is it the right way to have source/destination and other
# non-Amount properties set on the generated movement ?
# non-Amount properties set on the generated movement ?
movement
=
input_movement
.
asContext
(
**
dict
((
k
,
v
)
movement
=
input_movement
.
asContext
(
**
{
k
:
v
for
k
,
v
in
amount
.
__dict__
.
iteritems
()
for
k
,
v
in
amount
.
__dict__
.
iteritems
()
if
k
[
0
]
!=
'_'
and
k
!=
'categories'
)
)
if
k
[
0
]
!=
'_'
and
k
!=
'categories'
}
)
base_category_set
=
set
(
amount
.
getBaseCategoryList
())
base_category_set
=
set
(
amount
.
getBaseCategoryList
())
base_category_set
.
remove
(
'price_currency'
)
# XXX
base_category_set
.
remove
(
'price_currency'
)
# XXX
movement
.
_setCategoryMembership
(
base_category_set
,
movement
.
_setCategoryMembership
(
base_category_set
,
...
...
product/ERP5/Document/VariationEquivalenceTester.py
View file @
23d7bdd2
...
@@ -116,6 +116,6 @@ class VariationEquivalenceTester(Predicate, EquivalenceTesterMixin):
...
@@ -116,6 +116,6 @@ class VariationEquivalenceTester(Predicate, EquivalenceTesterMixin):
decision_movement -- a delivery movement (decision)
decision_movement -- a delivery movement (decision)
"""
"""
get
=
self
.
_getTestedPropertyValue
get
=
self
.
_getTestedPropertyValue
return
dict
((
tested_property
,
get
(
prevision_movement
,
tested_property
)
)
return
{
tested_property
:
get
(
prevision_movement
,
tested_property
)
for
tested_property
in
(
'variation_category_list'
,
for
tested_property
in
(
'variation_category_list'
,
'variation_property_dict'
))
'variation_property_dict'
)}
product/ERP5/ExplanationCache.py
View file @
23d7bdd2
...
@@ -240,7 +240,7 @@ class ExplanationCache:
...
@@ -240,7 +240,7 @@ class ExplanationCache:
# Build a list of path patterns which apply to current business_link
# Build a list of path patterns which apply to current business_link
path_list = iter(self.getSimulationPathPatternList())
path_list = iter(self.getSimulationPathPatternList())
path_dict =
dict((x, path_list.next()) for x in path_list)
path_dict =
{x: path_list.next() for x in path_list}
# path_dict is like this;
# path_dict is like this;
# {'
/
erp5
/
portal_simulation
/
3
/
4
': r'
/
erp5
/
portal
\
_simulation
/
3
/
4
/%
'}
# {'
/
erp5
/
portal_simulation
/
3
/
4
': r'
/
erp5
/
portal
\
_simulation
/
3
/
4
/%
'}
path_list = []
path_list = []
...
...
product/ERP5/Tool/TaskDistributionTool.py
View file @
23d7bdd2
...
@@ -228,8 +228,8 @@ class TaskDistributionTool(BaseTool):
...
@@ -228,8 +228,8 @@ class TaskDistributionTool(BaseTool):
"""
"""
extract all xmlrpclib.Binary instance
extract all xmlrpclib.Binary instance
"""
"""
return
dict
([(
x
,
isinstance
(
y
,
Binary
)
and
y
.
data
or
y
)
\
return
{
x
:
y
.
data
if
isinstance
(
y
,
Binary
)
else
y
for
(
x
,
y
)
in
xmlrpc_dict
.
iteritems
()])
for
x
,
y
in
xmlrpc_dict
.
iteritems
()}
security
.
declarePublic
(
'reportTaskFailure'
)
security
.
declarePublic
(
'reportTaskFailure'
)
def
reportTaskFailure
(
self
,
test_result_path
,
status_dict
,
node_title
):
def
reportTaskFailure
(
self
,
test_result_path
,
status_dict
,
node_title
):
...
...
product/ERP5/Tool/TemplateTool.py
View file @
23d7bdd2
...
@@ -1177,8 +1177,8 @@ class TemplateTool (BaseTool):
...
@@ -1177,8 +1177,8 @@ class TemplateTool (BaseTool):
operation_log = []
operation_log = []
resolved_template_list = self.resolveBusinessTemplateListDependency(
resolved_template_list = self.resolveBusinessTemplateListDependency(
template_list)
template_list)
installed_bt5_dict =
dict((x.getTitle(), x.getRevision()
)
installed_bt5_dict =
{x.getTitle(): x.getRevision(
)
for x in self.getInstalledBusinessTemplateList()
)
for x in self.getInstalledBusinessTemplateList()
}
if only_different:
if only_different:
template_url_dict = self._getBusinessTemplateUrlDict()
template_url_dict = self._getBusinessTemplateUrlDict()
...
...
product/ERP5/mixin/builder.py
View file @
23d7bdd2
...
@@ -526,14 +526,10 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -526,14 +526,10 @@ class BuilderMixin(XMLObject, Amount, Predicate):
return
return
# Update variation category list on line
# Update variation category list on line
variation_category_dict
=
dict
([(
variation_category
,
True
)
for
variation_category_set
=
set
(
delivery_line
.
getVariationCategoryList
())
variation_category
in
delivery_line
.
getVariationCategoryList
()])
for
movement
in
movement_group_node
.
getMovementList
():
for
movement
in
movement_group_node
.
getMovementList
():
for
category
in
movement
.
getVariationCategoryList
():
variation_category_set
.
update
(
movement
.
getVariationCategoryList
())
variation_category_dict
[
category
]
=
True
delivery_line
.
setVariationCategoryList
(
sorted
(
variation_category_set
))
variation_category_list
=
sorted
(
variation_category_dict
.
keys
())
delivery_line
.
setVariationCategoryList
(
variation_category_list
)
# Then, create delivery movement (delivery cell or complete delivery
# Then, create delivery movement (delivery cell or complete delivery
# line)
# line)
grouped_node_list
=
movement_group_node
.
getGroupList
()
grouped_node_list
=
movement_group_node
.
getGroupList
()
...
...
product/ERP5/tests/testAmount.py
View file @
23d7bdd2
...
@@ -118,8 +118,7 @@ class TestAmount(ERP5TypeTestCase):
...
@@ -118,8 +118,7 @@ class TestAmount(ERP5TypeTestCase):
resource
=
sequence
.
get
(
'resource'
)
resource
=
sequence
.
get
(
'resource'
)
amount
.
setResourceValue
(
resource
)
amount
.
setResourceValue
(
resource
)
sequence
.
edit
(
sequence
.
edit
(
variation_property_dict
=
\
variation_property_dict
=
dict
.
fromkeys
(
self
.
variation_property_dict
)
dict
([(
x
,
None
)
for
x
in
self
.
variation_property_dict
])
)
)
def
stepCheckEmptyGetVariationPropertyDict
(
self
,
sequence
=
None
,
def
stepCheckEmptyGetVariationPropertyDict
(
self
,
sequence
=
None
,
...
...
product/ERP5/tests/testInventoryAPI.py
View file @
23d7bdd2
...
@@ -3214,7 +3214,7 @@ class TestUnitConversion(BaseTestUnitConversion):
...
@@ -3214,7 +3214,7 @@ class TestUnitConversion(BaseTestUnitConversion):
(
None
,
None
,
None
,
None
),
## empty
(
None
,
None
,
None
,
None
),
## empty
)}.
iteritems
():
)}.
iteritems
():
for
measure
in
measure_list
:
for
measure
in
measure_list
:
kw
=
dict
((
keys
[
i
],
v
)
for
i
,
v
in
enumerate
(
measure
)
if
v
is
not
None
)
kw
=
{
keys
[
i
]:
v
for
i
,
v
in
enumerate
(
measure
)
if
v
is
not
None
}
resource
.
newContent
(
portal_type
=
'Measure'
,
**
kw
)
resource
.
newContent
(
portal_type
=
'Measure'
,
**
kw
)
self
.
resource
.
setOptionalVariationBaseCategory
(
'industrial_phase'
)
self
.
resource
.
setOptionalVariationBaseCategory
(
'industrial_phase'
)
...
...
product/ERP5/tests/testTemplateTool.py
View file @
23d7bdd2
...
@@ -611,14 +611,14 @@ class TestTemplateTool(ERP5TypeTestCase):
...
@@ -611,14 +611,14 @@ class TestTemplateTool(ERP5TypeTestCase):
many business templates that are already installed
many business templates that are already installed
"""
"""
template_tool
=
self
.
portal
.
portal_templates
template_tool
=
self
.
portal
.
portal_templates
before
=
dict
((
bt
.
getTitle
(),
bt
.
getId
()
)
before
=
{
bt
.
getTitle
():
bt
.
getId
(
)
for
bt
in
template_tool
.
getInstalledBusinessTemplateList
()
)
for
bt
in
template_tool
.
getInstalledBusinessTemplateList
()
}
bt_title
=
'erp5_calendar'
bt_title
=
'erp5_calendar'
template_tool
.
installBusinessTemplateListFromRepository
([
bt_title
],
template_tool
.
installBusinessTemplateListFromRepository
([
bt_title
],
install_dependency
=
True
)
install_dependency
=
True
)
self
.
tic
()
self
.
tic
()
after
=
dict
((
bt
.
getTitle
(),
bt
.
getId
()
)
after
=
{
bt
.
getTitle
():
bt
.
getId
(
)
for
bt
in
template_tool
.
getInstalledBusinessTemplateList
()
)
for
bt
in
template_tool
.
getInstalledBusinessTemplateList
()
}
del
after
[
bt_title
]
del
after
[
bt_title
]
self
.
assertEqual
(
before
,
after
)
self
.
assertEqual
(
before
,
after
)
...
@@ -645,19 +645,20 @@ class TestTemplateTool(ERP5TypeTestCase):
...
@@ -645,19 +645,20 @@ class TestTemplateTool(ERP5TypeTestCase):
fourth_group
=
range
(
10
,
12
)
fourth_group
=
range
(
10
,
12
)
fifth_group
=
range
(
12
,
13
)
fifth_group
=
range
(
12
,
13
)
expected_position_dict
=
dict
(((
'erp5_property_sheets'
,
first_group
),
expected_position_dict
=
{
(
'erp5_core_proxy_field_legacy'
,
first_group
),
'erp5_property_sheets'
:
first_group
,
(
'erp5_mysql_innodb_catalog'
,
first_group
),
'erp5_core_proxy_field_legacy'
:
first_group
,
(
'erp5_core'
,
first_group
),
'erp5_mysql_innodb_catalog'
:
first_group
,
(
'erp5_full_text_myisam_catalog'
,
first_group
),
'erp5_core'
:
first_group
,
(
'erp5_xhtml_style'
,
first_group
),
'erp5_full_text_myisam_catalog'
:
first_group
,
(
'erp5_ingestion_mysql_innodb_catalog'
,
second_group
),
'erp5_xhtml_style'
:
first_group
,
(
'erp5_base'
,
second_group
),
'erp5_ingestion_mysql_innodb_catalog'
:
second_group
,
(
'erp5_jquery'
,
third_group
),
'erp5_base'
:
second_group
,
(
'erp5_ingestion'
,
third_group
),
'erp5_jquery'
:
third_group
,
(
'erp5_web'
,
fourth_group
),
'erp5_ingestion'
:
third_group
,
(
'erp5_crm'
,
fourth_group
),
'erp5_web'
:
fourth_group
,
(
'erp5_credential'
,
fifth_group
)))
'erp5_crm'
:
fourth_group
,
'erp5_credential'
:
fifth_group
}
for
bt
in
ordered_list
:
for
bt
in
ordered_list
:
self
.
assertTrue
(
ordered_list
.
index
(
bt
)
in
expected_position_dict
[
bt
[
1
]],
self
.
assertTrue
(
ordered_list
.
index
(
bt
)
in
expected_position_dict
[
bt
[
1
]],
...
...
product/ERP5/tests/testTradeModelLine.py
View file @
23d7bdd2
...
@@ -415,8 +415,8 @@ class TestTradeModelLine(TestTradeModelLineMixin):
...
@@ -415,8 +415,8 @@ class TestTradeModelLine(TestTradeModelLineMixin):
for
line
in
delivery
.
getMovementList
():
for
line
in
delivery
.
getMovementList
():
simulation_movement_list
,
=
\
simulation_movement_list
,
=
\
self
.
getTradeModelSimulationMovementList
(
line
)
self
.
getTradeModelSimulationMovementList
(
line
)
result_dict
=
dict
((
sm
.
getResourceValue
().
getUse
(),
sm
)
result_dict
=
{
sm
.
getResourceValue
().
getUse
():
sm
for
sm
in
simulation_movement_list
)
for
sm
in
simulation_movement_list
}
self
.
assertEqual
(
len
(
simulation_movement_list
),
self
.
assertEqual
(
len
(
simulation_movement_list
),
len
(
result_dict
))
len
(
result_dict
))
for
use
in
'discount'
,
'tax'
:
for
use
in
'discount'
,
'tax'
:
...
@@ -596,8 +596,8 @@ class TestTradeModelLine(TestTradeModelLineMixin):
...
@@ -596,8 +596,8 @@ class TestTradeModelLine(TestTradeModelLineMixin):
# on invoice, make specialise point to a new TC and check it diverged
# on invoice, make specialise point to a new TC and check it diverged
trade_condition
=
self
[
'trade_condition'
]
trade_condition
=
self
[
'trade_condition'
]
new_trade_condition
=
self
.
clone
(
trade_condition
)
new_trade_condition
=
self
.
clone
(
trade_condition
)
line_dict
=
dict
((
line
.
getReference
(),
line
)
line_dict
=
{
line
.
getReference
():
line
for
line
in
new_trade_condition
.
objectValues
())
for
line
in
new_trade_condition
.
objectValues
()}
line_dict
[
'discount'
].
edit
(
reference
=
'discount_2'
,
line_dict
[
'discount'
].
edit
(
reference
=
'discount_2'
,
price
=
self
.
new_discount_ratio
)
price
=
self
.
new_discount_ratio
)
line_dict
[
'tax'
].
edit
(
reference
=
'tax_2'
,
line_dict
[
'tax'
].
edit
(
reference
=
'tax_2'
,
...
...
product/ERP5/tests/testTranslation.py
View file @
23d7bdd2
...
@@ -149,8 +149,8 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
...
@@ -149,8 +149,8 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
# State ID has multiple translation associated, and it leads to
# State ID has multiple translation associated, and it leads to
# unexpected results for the user when using portal catalog.
# unexpected results for the user when using portal catalog.
rejected_key_list
=
translation_dict
.
keys
()
rejected_key_list
=
translation_dict
.
keys
()
result_dict
=
dict
([(
x
,
[])
for
x
in
rejected_key_list
])
result_dict
=
{
x
:
[]
for
x
in
rejected_key_list
}
error_dict
=
dict
([(
x
,
[])
for
x
in
rejected_key_list
])
error_dict
=
{
x
:
[]
for
x
in
rejected_key_list
}
error
=
0
error
=
0
# Browse all workflows to ease fixing this issue.
# Browse all workflows to ease fixing this issue.
...
...
product/ERP5/tests/testWorklist.py
View file @
23d7bdd2
...
@@ -163,8 +163,8 @@ class TestWorklist(ERP5TypeTestCase):
...
@@ -163,8 +163,8 @@ class TestWorklist(ERP5TypeTestCase):
worklists
.
addWorklist
(
worklist_id
)
worklists
.
addWorklist
(
worklist_id
)
worklists
.
_getOb
(
worklist_id
).
setProperties
(
''
,
worklists
.
_getOb
(
worklist_id
).
setProperties
(
''
,
actbox_name
=
'%s (%%(count)s)'
%
actbox_name
,
actbox_url
=
actbox_url
,
actbox_name
=
'%s (%%(count)s)'
%
actbox_name
,
actbox_url
=
actbox_url
,
props
=
dict
((
k
.
startswith
(
'guard_'
)
and
k
or
'var_match_'
+
k
,
v
)
props
=
{
k
if
k
.
startswith
(
'guard_'
)
else
'var_match_'
+
k
:
v
for
k
,
v
in
kw
.
iteritems
())
)
for
k
,
v
in
kw
.
iteritems
()}
)
def
removeWorklist
(
self
,
workflow_id
,
worklist_id_list
):
def
removeWorklist
(
self
,
workflow_id
,
worklist_id_list
):
worklists
=
self
.
getWorkflowTool
()[
workflow_id
].
worklists
worklists
=
self
.
getWorkflowTool
()[
workflow_id
].
worklists
...
...
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
23d7bdd2
...
@@ -3935,9 +3935,8 @@ VALUES
...
@@ -3935,9 +3935,8 @@ VALUES
org4
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'org4'
)
org4
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'org4'
)
org4
.
setGroupList
([
'nexedi'
,
'tiolive'
])
org4
.
setGroupList
([
'nexedi'
,
'tiolive'
])
# check associations are correct
# check associations are correct
actual_group_title_map
=
dict
((
org
.
getTitle
(),
actual_group_title_map
=
{
org
.
getTitle
():
sorted
(
org
.
getGroupTitleList
())
sorted
(
org
.
getGroupTitleList
()))
for
org
in
(
org1
,
org2
,
org3
,
org4
)}
for
org
in
(
org1
,
org2
,
org3
,
org4
))
expected_group_title_map
=
dict
(
org1
=
[],
expected_group_title_map
=
dict
(
org1
=
[],
org2
=
[
'Nexedi'
],
org2
=
[
'Nexedi'
],
org3
=
[
'TIOLive'
],
org3
=
[
'TIOLive'
],
...
...
product/ERP5Configurator/Document/WorkflowSecurityConfiguratorItem.py
View file @
23d7bdd2
...
@@ -93,7 +93,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -93,7 +93,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject):
for
permission
in
permission_list
:
for
permission
in
permission_list
:
state
.
setPermission
(
permission
,
0
,
[])
state
.
setPermission
(
permission
,
0
,
[])
# Update state matrix
# Update state matrix
permission_dict
=
dict
([(
x
,
[])
for
x
in
permission_list
])
permission_dict
=
{
x
:
[]
for
x
in
permission_list
}
for
role
,
perm_symbol
in
state_config
.
items
():
for
role
,
perm_symbol
in
state_config
.
items
():
managed_permission_list
=
[]
managed_permission_list
=
[]
if
'A'
in
perm_symbol
:
if
'A'
in
perm_symbol
:
...
...
product/ERP5Form/MultiRelationField.py
View file @
23d7bdd2
...
@@ -68,9 +68,12 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
...
@@ -68,9 +68,12 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
'size'
,
'extra_item'
,
'size'
,
'extra_item'
,
]
]
property_names
=
Widget
.
LinesTextAreaWidget
.
property_names
+
\
property_names
=
(
lambda
name_list
,
name_set
=
set
():
Widget
.
TextWidget
.
property_names
+
\
# delete double (but preserve order) in order to keep a usable ZMI...
local_property_names
[
x
for
x
in
name_list
if
not
(
x
in
name_set
or
name_set
.
add
(
x
))])(
Widget
.
LinesTextAreaWidget
.
property_names
+
Widget
.
TextWidget
.
property_names
+
local_property_names
)
# XXX Field to remove...
# XXX Field to remove...
update_method
=
fields
.
StringField
(
'update_method'
,
update_method
=
fields
.
StringField
(
'update_method'
,
...
@@ -194,17 +197,6 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
...
@@ -194,17 +197,6 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
default
=
''
,
default
=
''
,
required
=
0
)
required
=
0
)
# delete double in order to keep a usable ZMI...
# XXX need to keep order !
#property_names = dict([(i,0) for i in property_names]).keys()
_v_dict
=
{}
_v_property_name_list
=
[]
for
property_name
in
property_names
:
if
not
_v_dict
.
has_key
(
property_name
):
_v_property_name_list
.
append
(
property_name
)
_v_dict
[
property_name
]
=
1
property_names
=
_v_property_name_list
default_widget_rendering_instance
=
Widget
.
LinesTextAreaWidgetInstance
default_widget_rendering_instance
=
Widget
.
LinesTextAreaWidgetInstance
def
_getContextValue
(
self
,
field
,
REQUEST
):
def
_getContextValue
(
self
,
field
,
REQUEST
):
...
...
product/ERP5Form/ParallelListField.py
View file @
23d7bdd2
...
@@ -68,9 +68,12 @@ class ParallelListWidget(Widget.MultiListWidget,
...
@@ -68,9 +68,12 @@ class ParallelListWidget(Widget.MultiListWidget,
default: 0
default: 0
"""
"""
property_names
=
Widget
.
MultiListWidget
.
property_names
+
\
property_names
=
(
lambda
name_list
,
name_set
=
set
():
Widget
.
ListWidget
.
property_names
+
\
# delete double (but preserve order) in order to keep a usable ZMI...
[
'hash_script_id'
]
[
x
for
x
in
name_list
if
not
(
x
in
name_set
or
name_set
.
add
(
x
))])(
Widget
.
MultiListWidget
.
property_names
+
Widget
.
ListWidget
.
property_names
+
[
'hash_script_id'
])
hash_script_id
=
fields
.
StringField
(
'hash_script_id'
,
hash_script_id
=
fields
.
StringField
(
'hash_script_id'
,
title
=
'Hash script'
,
title
=
'Hash script'
,
...
@@ -78,17 +81,6 @@ class ParallelListWidget(Widget.MultiListWidget,
...
@@ -78,17 +81,6 @@ class ParallelListWidget(Widget.MultiListWidget,
"The method to call to hash items list."
),
"The method to call to hash items list."
),
required
=
0
)
required
=
0
)
# delete double in order to keep a usable ZMI...
# XXX need to keep order !
#property_names = dict([(i,0) for i in property_names]).keys()
_v_dict
=
{}
_v_property_name_list
=
[]
for
property_name
in
property_names
:
if
not
_v_dict
.
has_key
(
property_name
):
_v_property_name_list
.
append
(
property_name
)
_v_dict
[
property_name
]
=
1
property_names
=
_v_property_name_list
def
__init__
(
self
):
def
__init__
(
self
):
"""
"""
Generate some subwidget used for rendering.
Generate some subwidget used for rendering.
...
...
product/ERP5Form/Selection.py
View file @
23d7bdd2
...
@@ -163,8 +163,8 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -163,8 +163,8 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
# We should only keep params which do not start with field_
# We should only keep params which do not start with field_
# in order to make sure we do not collect unwanted params
# in order to make sure we do not collect unwanted params
# resulting form the REQUEST generated by an ERP5Form submit
# resulting form the REQUEST generated by an ERP5Form submit
params
=
dict
(
[
item
for
item
in
params
.
iteritems
()
\
params
=
dict
(
item
for
item
in
params
.
iteritems
()
if
not
item
[
0
].
startswith
(
'field_'
)]
)
if
not
item
[
0
].
startswith
(
'field_'
)
)
if
self
.
params
!=
params
:
if
self
.
params
!=
params
:
self
.
params
=
params
self
.
params
=
params
if
kw
is
not
None
:
if
kw
is
not
None
:
...
@@ -371,7 +371,8 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -371,7 +371,8 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
security
.
declarePublic
(
'getAnonymousSelectionKey'
)
security
.
declarePublic
(
'getAnonymousSelectionKey'
)
def
getAnonymousSelectionKey
(
self
):
def
getAnonymousSelectionKey
(
self
):
return
md5
(
repr
(
dict
([(
k
,
v
)
for
k
,
v
in
self
.
__dict__
.
iteritems
()
if
k
!=
'index'
]))).
hexdigest
()
return
md5
(
repr
({
k
:
v
for
k
,
v
in
self
.
__dict__
.
iteritems
()
if
k
!=
'index'
})).
hexdigest
()
InitializeClass
(
Selection
)
InitializeClass
(
Selection
)
allow_class
(
Selection
)
allow_class
(
Selection
)
...
...
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
View file @
23d7bdd2
...
@@ -175,18 +175,13 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
...
@@ -175,18 +175,13 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
keyword
[
tag
]
=
value
keyword
[
tag
]
=
value
document
.
context
.
person_module
.
updatePersonAddress
(
**
keyword
)
document
.
context
.
person_module
.
updatePersonAddress
(
**
keyword
)
else
:
else
:
# getter used to retrieve the current values and to check conflicts
assert
tag
==
'birthday'
,
tag
property_list
=
[
'birthday'
,
]
current_value
=
getattr
(
document
,
tag
)
getter_value_dict
=
dict
([
assert
current_value
is
not
None
,
current_value
(
prop
,
getattr
(
document
,
prop
))
for
prop
in
property_list
if
getattr
(
document
,
prop
,
None
)
is
not
None
])
# create and fill a conflict when the integration site value, the erp5
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
# value and the previous value are differents
current_value
=
getter_value_dict
[
tag
]
if
value
!=
current_value
!=
previous_value
:
if
current_value
not
in
[
value
,
previous_value
]:
conflict_list
.
append
(
self
.
_generateConflict
(
path
=
document
.
getPhysicalPath
(),
conflict_list
.
append
(
self
.
_generateConflict
(
path
=
document
.
getPhysicalPath
(),
tag
=
tag
,
tag
=
tag
,
xml
=
xml
,
xml
=
xml
,
...
...
product/ERP5Type/Accessor/Acquired.py
View file @
23d7bdd2
...
@@ -207,7 +207,4 @@ class SetGetter(ListGetter):
...
@@ -207,7 +207,4 @@ class SetGetter(ListGetter):
Gets a category value set
Gets a category value set
"""
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
result_set
=
dict
([(
x
,
0
)
for
x
in
result_list
]).
keys
()
return
result_set
product/ERP5Type/Accessor/Category.py
View file @
23d7bdd2
...
@@ -164,9 +164,7 @@ class SetGetter(ListGetter):
...
@@ -164,9 +164,7 @@ class SetGetter(ListGetter):
Gets a category value set
Gets a category value set
"""
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
result_set
=
dict
([(
x
,
0
)
for
x
in
result_list
]).
keys
()
return
result_set
# ItemList is outdated XXX -> ItemList
# ItemList is outdated XXX -> ItemList
...
...
product/ERP5Type/Accessor/Related.py
View file @
23d7bdd2
...
@@ -105,6 +105,4 @@ class SetGetter(ListGetter):
...
@@ -105,6 +105,4 @@ class SetGetter(ListGetter):
Gets a category value set
Gets a category value set
"""
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
result_set
=
dict
([(
x
,
0
)
for
x
in
result_list
]).
keys
()
return
result_set
product/ERP5Type/Accessor/RelatedValue.py
View file @
23d7bdd2
...
@@ -111,9 +111,7 @@ class SetGetter(ListGetter):
...
@@ -111,9 +111,7 @@ class SetGetter(ListGetter):
Gets a category value set
Gets a category value set
"""
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
result_set
=
dict
([(
x
,
0
)
for
x
in
result_list
]).
keys
()
return
result_set
class
DefaultPropertyGetter
(
BaseGetter
):
class
DefaultPropertyGetter
(
BaseGetter
):
...
@@ -193,9 +191,7 @@ class PropertySetGetter(PropertyListGetter):
...
@@ -193,9 +191,7 @@ class PropertySetGetter(PropertyListGetter):
Gets a category value set
Gets a category value set
"""
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
PropertyListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
return
list
(
set
(
PropertyListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
result_set
=
dict
([(
x
,
0
)
for
x
in
result_list
]).
keys
()
return
result_set
class
DefaultIdGetter
(
PropertyGetter
):
class
DefaultIdGetter
(
PropertyGetter
):
...
...
product/ERP5Type/Core/AcquiredProperty.py
View file @
23d7bdd2
...
@@ -73,9 +73,10 @@ class AcquiredProperty(StandardProperty):
...
@@ -73,9 +73,10 @@ class AcquiredProperty(StandardProperty):
'translation_acquired_property_id'
)
'translation_acquired_property_id'
)
# Add names specific to 'content' type (see StandardProperty)
# Add names specific to 'content' type (see StandardProperty)
_name_mapping_filesystem_to_zodb_dict
=
\
_name_mapping_filesystem_to_zodb_dict
=
{
name
:
'content_'
+
name
dict
([
(
name
,
'content_'
+
name
,)
for
name
in
_content_type_attribute_tuple
],
for
name
in
_content_type_attribute_tuple
}
**
StandardProperty
.
_name_mapping_filesystem_to_zodb_dict
)
_name_mapping_filesystem_to_zodb_dict
.
update
(
StandardProperty
.
_name_mapping_filesystem_to_zodb_dict
)
# ZODB name of attributes whose value is a TALES Expression string
# ZODB name of attributes whose value is a TALES Expression string
_expression_attribute_tuple
=
\
_expression_attribute_tuple
=
\
...
...
product/ERP5Type/Tool/TypesTool.py
View file @
23d7bdd2
...
@@ -344,9 +344,9 @@ class OldTypesTool(OFSFolder):
...
@@ -344,9 +344,9 @@ class OldTypesTool(OFSFolder):
new_type
.
_importRole
(
role
.
__getstate__
())
new_type
.
_importRole
(
role
.
__getstate__
())
elif
k
not
in
(
'uid'
,
'isIndexable'
):
elif
k
not
in
(
'uid'
,
'isIndexable'
):
if
k
==
'_property_domain_dict'
:
if
k
==
'_property_domain_dict'
:
v
=
dict
((
k
,
t
.
__class__
(
property_name
=
t
.
property_name
,
v
=
{
k
:
t
.
__class__
(
property_name
=
t
.
property_name
,
domain_name
=
t
.
domain_name
)
)
domain_name
=
t
.
domain_name
)
for
k
,
t
in
v
.
iteritems
())
for
k
,
t
in
v
.
iteritems
()}
setattr
(
new_type
,
k
,
v
)
setattr
(
new_type
,
k
,
v
)
finally
:
finally
:
del
new_type
.
generateNewId
del
new_type
.
generateNewId
...
...
product/ERP5Type/TranslationProviderBase.py
View file @
23d7bdd2
...
@@ -47,8 +47,7 @@ class TranslationProviderBase(object):
...
@@ -47,8 +47,7 @@ class TranslationProviderBase(object):
pass
pass
else
:
else
:
property_domain_dict
.
update
(
my_property_domain_dict
)
property_domain_dict
.
update
(
my_property_domain_dict
)
return
dict
((
k
,
v
.
__of__
(
self
))
return
{
k
:
v
.
__of__
(
self
)
for
k
,
v
in
property_domain_dict
.
iteritems
()}
for
k
,
v
in
property_domain_dict
.
iteritems
())
security
.
declarePublic
(
'getContentTranslationDomainPropertyNameList'
)
security
.
declarePublic
(
'getContentTranslationDomainPropertyNameList'
)
def
getContentTranslationDomainPropertyNameList
(
self
):
def
getContentTranslationDomainPropertyNameList
(
self
):
...
...
product/ERP5Type/Utils.py
View file @
23d7bdd2
...
@@ -1720,14 +1720,16 @@ def guessEncodingFromText(data, content_type='text/html'):
...
@@ -1720,14 +1720,16 @@ def guessEncodingFromText(data, content_type='text/html'):
'
You
must
install
python
-
magic
'
'
You
must
install
python
-
magic
'
raise NotImplementedError, message
raise NotImplementedError, message
_reencodeUrlEscapes_map = dict((chr(x), chr(x) in (# safe
_reencodeUrlEscapes_map = {chr(x): chr(x) if chr(x) in
# safe
"!'
()
*-
.
" "
0123456789
" "
_
~
"
"!'
()
*-
.
" "
0123456789
" "
_
~
"
"
ABCDEFGHIJKLMNOPQRSTUVWXYZ
"
"
ABCDEFGHIJKLMNOPQRSTUVWXYZ
"
"
abcdefghijklmnopqrstuvwxyz
"
"
abcdefghijklmnopqrstuvwxyz
"
# reserved (maybe unsafe)
# reserved (maybe unsafe)
"
#$&+,/:;=?@[]")
"
#$&+,/:;=?@[]"
and
chr
(
x
)
or
"%%%02X"
%
x
)
else
"%%%02X"
%
x
for
x
in
xrange
(
256
))
for
x
in
xrange
(
256
)}
def
reencodeUrlEscapes
(
url
):
def
reencodeUrlEscapes
(
url
):
"""Fix a non-conformant %-escaped URL (or quote an unescaped one)
"""Fix a non-conformant %-escaped URL (or quote an unescaped one)
...
...
product/ERP5Type/patches/DCWorkflow.py
View file @
23d7bdd2
...
@@ -318,8 +318,8 @@ def DCWorkflowDefinition_getWorklistVariableMatchDict(self, info,
...
@@ -318,8 +318,8 @@ def DCWorkflowDefinition_getWorklistVariableMatchDict(self, info,
format_data
=
TemplateDict
()
format_data
=
TemplateDict
()
format_data
.
_push
(
info
)
format_data
.
_push
(
info
)
variable_match
.
setdefault
(
SECURITY_PARAMETER_ID
,
())
variable_match
.
setdefault
(
SECURITY_PARAMETER_ID
,
())
format_data
.
_push
(
dict
((
k
,
(
'&%s:list='
%
k
).
join
(
v
))
for
\
format_data
.
_push
(
{
k
:
(
'&%s:list='
%
k
).
join
(
v
)
k
,
v
in
variable_match
.
iteritems
())
)
for
k
,
v
in
variable_match
.
iteritems
()}
)
variable_match
[
WORKLIST_METADATA_KEY
]
=
{
'format_data'
:
format_data
,
variable_match
[
WORKLIST_METADATA_KEY
]
=
{
'format_data'
:
format_data
,
'worklist_title'
:
action_box_name
,
'worklist_title'
:
action_box_name
,
'worklist_id'
:
worklist_id
,
'worklist_id'
:
worklist_id
,
...
...
product/ERP5Type/patches/WorkflowTool.py
View file @
23d7bdd2
...
@@ -382,8 +382,8 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result):
...
@@ -382,8 +382,8 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result):
if
len
(
catalog_result
)
>
0
:
if
len
(
catalog_result
)
>
0
:
# Transtype all worklist definitions where needed
# Transtype all worklist definitions where needed
criterion_id_list
=
[]
criterion_id_list
=
[]
class_dict
=
dict
(((
name
,
_sql_cast_dict
.
get
(
x
[
'type'
],
_sql_cast_fallback
)
)
class_dict
=
{
name
:
_sql_cast_dict
.
get
(
x
[
'type'
],
_sql_cast_fallback
)
for
name
,
x
in
catalog_result
.
data_dictionary
().
iteritems
()
))
for
name
,
x
in
catalog_result
.
data_dictionary
().
iteritems
()
}
for
criterion_dict
in
grouped_worklist_dict
.
itervalues
():
for
criterion_dict
in
grouped_worklist_dict
.
itervalues
():
for
criterion_id
,
criterion_value_list
in
criterion_dict
.
iteritems
():
for
criterion_id
,
criterion_value_list
in
criterion_dict
.
iteritems
():
if
type
(
criterion_value_list
)
is
not
ExclusionList
:
if
type
(
criterion_value_list
)
is
not
ExclusionList
:
...
@@ -691,7 +691,7 @@ def WorkflowTool_refreshWorklistCache(self):
...
@@ -691,7 +691,7 @@ def WorkflowTool_refreshWorklistCache(self):
#LOG('refreshWorklistCache', WARNING, 'Using query: %s' % \
#LOG('refreshWorklistCache', WARNING, 'Using query: %s' % \
# (search_result(src__=1, **search_result_kw), ))
# (search_result(src__=1, **search_result_kw), ))
catalog_brain_result
=
search_result
(
**
search_result_kw
)
catalog_brain_result
=
search_result
(
**
search_result_kw
)
value_column_dict
=
dict
([(
x
,
[])
for
x
in
table_column_id_set
])
value_column_dict
=
{
x
:
[]
for
x
in
table_column_id_set
}
for
catalog_brain_line
in
catalog_brain_result
.
dictionaries
():
for
catalog_brain_line
in
catalog_brain_result
.
dictionaries
():
for
column_id
,
value
in
catalog_brain_line
.
iteritems
():
for
column_id
,
value
in
catalog_brain_line
.
iteritems
():
if
column_id
in
value_column_dict
:
if
column_id
in
value_column_dict
:
...
...
product/ERP5VCS/Subversion.py
View file @
23d7bdd2
...
@@ -381,8 +381,8 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
...
@@ -381,8 +381,8 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
def export(self, business_template):
def export(self, business_template):
# Dicts to track svn status in case it is not consistent with existing
# Dicts to track svn status in case it is not consistent with existing
# files and directories
# files and directories
self.versioned_dict =
dict((x.getPath(), x)
for x in self.client.status('
.
')
self.versioned_dict =
{x.getPath(): x
for x in self.client.status('
.
')
if str(x.getTextStatus()) not in ('
ignored
', '
unversioned
')
)
if str(x.getTextStatus()) not in ('
ignored
', '
unversioned
')
}
del self.versioned_dict['
.
']
del self.versioned_dict['
.
']
self.versioned_dict[''] = None
self.versioned_dict[''] = None
self.added_set = set()
self.added_set = set()
...
...
product/ERP5VCS/SubversionClient.py
View file @
23d7bdd2
...
@@ -376,8 +376,7 @@ try:
...
@@ -376,8 +376,7 @@ try:
# transform entry to dict to make it more usable in zope
# transform entry to dict to make it more usable in zope
members_tuple
=
(
'url'
,
'uuid'
,
'revision'
,
'kind'
,
\
members_tuple
=
(
'url'
,
'uuid'
,
'revision'
,
'kind'
,
\
'commit_author'
,
'commit_revision'
,
'commit_time'
,)
'commit_author'
,
'commit_revision'
,
'commit_time'
,)
entry_dict
=
dict
([(
member
,
getattr
(
entry
,
member
))
\
entry_dict
=
{
member
:
getattr
(
entry
,
member
)
for
member
in
members_tuple
}
for
member
in
members_tuple
])
entry_dict
[
'revision'
]
=
entry_dict
[
'revision'
].
number
entry_dict
[
'revision'
]
=
entry_dict
[
'revision'
].
number
entry_dict
[
'commit_revision'
]
=
entry_dict
[
'commit_revision'
].
number
entry_dict
[
'commit_revision'
]
=
entry_dict
[
'commit_revision'
].
number
entry_dict
[
'commit_time'
]
=
DateTime
(
entry_dict
[
'commit_time'
])
entry_dict
[
'commit_time'
]
=
DateTime
(
entry_dict
[
'commit_time'
])
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
23d7bdd2
...
@@ -1661,12 +1661,9 @@ class Catalog(Folder,
...
@@ -1661,12 +1661,9 @@ class Catalog(Folder,
method
.
func_code
.
co_varnames
[:
method
.
func_code
.
co_argcount
]
method
.
func_code
.
co_varnames
[:
method
.
func_code
.
co_argcount
]
else
:
else
:
arguments
=
[]
arguments
=
[]
kw
=
dict
(
kw
=
{
x
:
LazyIndexationParameterList
(
catalogged_object_list
,
(
x
,
LazyIndexationParameterList
(
x
,
argument_cache
)
catalogged_object_list
,
for
x
in
arguments
}
x
,
argument_cache
,
))
for
x
in
arguments
)
# Alter/Create row
# Alter/Create row
try
:
try
:
...
@@ -2352,7 +2349,7 @@ class Catalog(Folder,
...
@@ -2352,7 +2349,7 @@ class Catalog(Folder,
else
:
else
:
select_dict
=
None
select_dict
=
None
elif
isinstance
(
select_dict
,
(
list
,
tuple
)):
elif
isinstance
(
select_dict
,
(
list
,
tuple
)):
select_dict
=
dict
([(
x
,
None
)
for
x
in
select_dict
]
)
select_dict
=
dict
.
fromkeys
(
select_dict
)
# Handle left_join_list
# Handle left_join_list
left_join_list
=
kw
.
pop
(
'left_join_list'
,
())
left_join_list
=
kw
.
pop
(
'left_join_list'
,
())
# Handle implicit_join. It's True by default, as there's a lot of code
# Handle implicit_join. It's True by default, as there's a lot of code
...
...
product/ZSQLCatalog/SearchKey/RelatedKey.py
View file @
23d7bdd2
...
@@ -211,9 +211,8 @@ class RelatedKey(SearchKey):
...
@@ -211,9 +211,8 @@ class RelatedKey(SearchKey):
destination_table
))
destination_table
))
# map aliases to use in ZSQLMethod.
# map aliases to use in ZSQLMethod.
table_alias_dict
=
dict
((
'table_%s'
%
(
index
,
),
table_alias
)
table_alias_dict
=
{
'table_%s'
%
index
:
alias
[
0
]
for
(
index
,
(
table_alias
,
table_name
))
for
index
,
alias
in
enumerate
(
table_alias_list
)}
in
enumerate
(
table_alias_list
))
assert
len
(
table_alias_list
)
==
len
(
table_alias_dict
)
assert
len
(
table_alias_list
)
==
len
(
table_alias_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