Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
c11e08ba
Commit
c11e08ba
authored
Apr 20, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: 2to3: iteritems/itervalues.
parent
5b1d72b4
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
105 additions
and
106 deletions
+105
-106
product/CMFActivity/ActivityBuffer.py
product/CMFActivity/ActivityBuffer.py
+1
-1
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+10
-10
product/CMFActivity/sbalance.py
product/CMFActivity/sbalance.py
+1
-1
product/CMFCategory/Filter.py
product/CMFCategory/Filter.py
+1
-1
product/DeadlockDebugger/dumper.py
product/DeadlockDebugger/dumper.py
+1
-1
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+32
-32
product/ERP5/Document/Resource.py
product/ERP5/Document/Resource.py
+2
-2
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+1
-1
product/ERP5/Extensions/Diff.py
product/ERP5/Extensions/Diff.py
+1
-1
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Amount.py
...entTemplateItem/portal_components/document.erp5.Amount.py
+1
-1
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.AppliedRule.py
...mplateItem/portal_components/document.erp5.AppliedRule.py
+1
-1
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.py
...teItem/portal_components/document.erp5.BusinessProcess.py
+1
-1
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.ContributionPredicate.py
.../portal_components/document.erp5.ContributionPredicate.py
+2
-2
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.SimulationMovement.py
...tem/portal_components/document.erp5.SimulationMovement.py
+1
-1
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.AmountGeneratorMixin.py
...Item/portal_components/mixin.erp5.AmountGeneratorMixin.py
+2
-2
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.DiscoverableMixin.py
...ateItem/portal_components/mixin.erp5.DiscoverableMixin.py
+1
-1
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.GeneratedAmountList.py
...Item/portal_components/module.erp5.GeneratedAmountList.py
+1
-1
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.WebDAVSupport.py
...mplateItem/portal_components/module.erp5.WebDAVSupport.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.py
...portal_skins/erp5_core/CategoryTool_importCategoryFile.py
+2
-2
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.RuleTool.py
...onentTemplateItem/portal_components/tool.erp5.RuleTool.py
+1
-1
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SimulationTool.py
...emplateItem/portal_components/tool.erp5.SimulationTool.py
+3
-4
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslationQuery.py
...alog/erp5_mysql_innodb/SQLCatalog_makeTranslationQuery.py
+1
-1
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
...em/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
+1
-1
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
+15
-15
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+8
-8
product/ERP5/tests/testSpellChecking.py
product/ERP5/tests/testSpellChecking.py
+2
-2
product/ERP5/tests/utils.py
product/ERP5/tests/utils.py
+1
-1
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+9
-9
product/ERP5Catalog/Document/ERP5Catalog.py
product/ERP5Catalog/Document/ERP5Catalog.py
+1
-1
No files found.
product/CMFActivity/ActivityBuffer.py
View file @
c11e08ba
...
@@ -59,7 +59,7 @@ class ActivityBuffer(TM):
...
@@ -59,7 +59,7 @@ class ActivityBuffer(TM):
try
:
try
:
activity_tool
=
self
.
activity_tool
activity_tool
=
self
.
activity_tool
# Try to push all messages
# Try to push all messages
for
activity
,
message_list
in
s
elf
.
message_list_dict
.
iteritems
(
):
for
activity
,
message_list
in
s
ix
.
iteritems
(
self
.
message_list_dict
):
activity
.
prepareQueueMessageList
(
activity_tool
,
message_list
)
activity
.
prepareQueueMessageList
(
activity_tool
,
message_list
)
self
.
message_list_dict
.
clear
()
self
.
message_list_dict
.
clear
()
self
.
activity_tool
=
None
self
.
activity_tool
=
None
...
...
product/CMFActivity/ActivityTool.py
View file @
c11e08ba
...
@@ -702,7 +702,7 @@ class ActivityTool (BaseTool):
...
@@ -702,7 +702,7 @@ class ActivityTool (BaseTool):
security
.
declarePrivate
(
'initialize'
)
security
.
declarePrivate
(
'initialize'
)
def
initialize
(
self
):
def
initialize
(
self
):
self
.
maybeMigrateConnectionClass
()
self
.
maybeMigrateConnectionClass
()
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
activity
.
initialize
(
self
,
clear
=
False
)
activity
.
initialize
(
self
,
clear
=
False
)
# Remove old skin if any.
# Remove old skin if any.
skins_tool
=
self
.
getPortalObject
().
portal_skins
skins_tool
=
self
.
getPortalObject
().
portal_skins
...
@@ -1328,7 +1328,7 @@ class ActivityTool (BaseTool):
...
@@ -1328,7 +1328,7 @@ class ActivityTool (BaseTool):
Distribute load
Distribute load
"""
"""
# Call distribute on each queue
# Call distribute on each queue
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
activity
.
distribute
(
aq_inner
(
self
),
node_count
)
activity
.
distribute
(
aq_inner
(
self
),
node_count
)
security
.
declarePublic
(
'tic'
)
security
.
declarePublic
(
'tic'
)
...
@@ -1392,7 +1392,7 @@ class ActivityTool (BaseTool):
...
@@ -1392,7 +1392,7 @@ class ActivityTool (BaseTool):
quote
=
db
.
string_literal
quote
=
db
.
string_literal
return
bool
(
db
.
query
(
"(%s)"
%
") UNION ALL ("
.
join
(
return
bool
(
db
.
query
(
"(%s)"
%
") UNION ALL ("
.
join
(
activity
.
hasActivitySQL
(
quote
,
path
=
path
,
**
kw
)
activity
.
hasActivitySQL
(
quote
,
path
=
path
,
**
kw
)
for
activity
in
activity_dict
.
itervalues
(
)))[
1
])
for
activity
in
six
.
itervalues
(
activity_dict
)))[
1
])
security
.
declarePrivate
(
'getActivityBuffer'
)
security
.
declarePrivate
(
'getActivityBuffer'
)
def
getActivityBuffer
(
self
,
create_if_not_found
=
True
):
def
getActivityBuffer
(
self
,
create_if_not_found
=
True
):
...
@@ -1494,7 +1494,7 @@ class ActivityTool (BaseTool):
...
@@ -1494,7 +1494,7 @@ class ActivityTool (BaseTool):
object_path
=
obj
object_path
=
obj
else
:
else
:
object_path
=
obj
.
getPhysicalPath
()
object_path
=
obj
.
getPhysicalPath
()
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
activity
.
flush
(
aq_inner
(
self
),
object_path
,
invoke
=
invoke
,
**
kw
)
activity
.
flush
(
aq_inner
(
self
),
object_path
,
invoke
=
invoke
,
**
kw
)
def
invoke
(
self
,
message
):
def
invoke
(
self
,
message
):
...
@@ -1629,7 +1629,7 @@ class ActivityTool (BaseTool):
...
@@ -1629,7 +1629,7 @@ class ActivityTool (BaseTool):
error_log
.
raising
(
exc_info
)
error_log
.
raising
(
exc_info
)
else
:
else
:
# Note there can be partial failures.
# Note there can be partial failures.
for
m
,
expanded_object_list
in
message_dict
.
iteritems
(
):
for
m
,
expanded_object_list
in
six
.
iteritems
(
message_dict
):
result_list
=
[]
result_list
=
[]
for
result
in
expanded_object_list
:
for
result
in
expanded_object_list
:
try
:
try
:
...
@@ -1741,7 +1741,7 @@ class ActivityTool (BaseTool):
...
@@ -1741,7 +1741,7 @@ class ActivityTool (BaseTool):
"""
"""
Recreate tables, clearing all activities
Recreate tables, clearing all activities
"""
"""
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
activity
.
initialize
(
self
,
clear
=
True
)
activity
.
initialize
(
self
,
clear
=
True
)
if
RESPONSE
is
not
None
:
if
RESPONSE
is
not
None
:
...
@@ -1770,7 +1770,7 @@ class ActivityTool (BaseTool):
...
@@ -1770,7 +1770,7 @@ class ActivityTool (BaseTool):
return
activity_dict
[
activity
].
getMessageList
(
aq_inner
(
self
),
**
kw
)
return
activity_dict
[
activity
].
getMessageList
(
aq_inner
(
self
),
**
kw
)
message_list
=
[]
message_list
=
[]
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
try
:
try
:
message_list
+=
activity
.
getMessageList
(
aq_inner
(
self
),
**
kw
)
message_list
+=
activity
.
getMessageList
(
aq_inner
(
self
),
**
kw
)
except
AttributeError
:
except
AttributeError
:
...
@@ -1800,7 +1800,7 @@ class ActivityTool (BaseTool):
...
@@ -1800,7 +1800,7 @@ class ActivityTool (BaseTool):
quote
=
db
.
string_literal
quote
=
db
.
string_literal
return
sum
(
x
for
x
,
in
db
.
query
(
"(%s)"
%
") UNION ALL ("
.
join
(
return
sum
(
x
for
x
,
in
db
.
query
(
"(%s)"
%
") UNION ALL ("
.
join
(
activity
.
countMessageSQL
(
quote
,
**
kw
)
activity
.
countMessageSQL
(
quote
,
**
kw
)
for
activity
in
activity_dict
.
itervalues
(
)))[
1
])
for
activity
in
six
.
itervalues
(
activity_dict
)))[
1
])
security
.
declareProtected
(
CMFCorePermissions
.
ManagePortal
,
'newActiveProcess'
)
security
.
declareProtected
(
CMFCorePermissions
.
ManagePortal
,
'newActiveProcess'
)
def
newActiveProcess
(
self
,
REQUEST
=
None
,
**
kw
):
def
newActiveProcess
(
self
,
REQUEST
=
None
,
**
kw
):
...
@@ -1813,11 +1813,11 @@ class ActivityTool (BaseTool):
...
@@ -1813,11 +1813,11 @@ class ActivityTool (BaseTool):
security
.
declarePrivate
(
'getSQLTableNameSet'
)
security
.
declarePrivate
(
'getSQLTableNameSet'
)
def
getSQLTableNameSet
(
self
):
def
getSQLTableNameSet
(
self
):
return
[
x
.
sql_table
for
x
in
activity_dict
.
itervalues
(
)]
return
[
x
.
sql_table
for
x
in
six
.
itervalues
(
activity_dict
)]
# Required for tests (time shift)
# Required for tests (time shift)
def
timeShift
(
self
,
delay
):
def
timeShift
(
self
,
delay
):
for
activity
in
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
activity_dict
):
activity
.
timeShift
(
aq_inner
(
self
),
delay
)
activity
.
timeShift
(
aq_inner
(
self
),
delay
)
InitializeClass
(
ActivityTool
)
InitializeClass
(
ActivityTool
)
product/CMFActivity/sbalance.py
100644 → 100755
View file @
c11e08ba
...
@@ -118,7 +118,7 @@ class Balancer:
...
@@ -118,7 +118,7 @@ class Balancer:
if
addr
not
in
self
.
disabled_server_dict
:
if
addr
not
in
self
.
disabled_server_dict
:
count_dict
[
addr
]
=
0
count_dict
[
addr
]
=
0
expired_server_list
=
[]
expired_server_list
=
[]
for
key
,
value
in
s
elf
.
sticked_server_dict
.
items
(
):
for
key
,
value
in
s
ix
.
iteritems
(
self
.
sticked_server_dict
):
if
self
.
debug
:
if
self
.
debug
:
print
(
'cur_time = %f, value.atime = %f'
%
(
cur_time
,
value
.
atime
))
print
(
'cur_time = %f, value.atime = %f'
%
(
cur_time
,
value
.
atime
))
if
cur_time
>
value
.
atime
+
60
*
10
:
if
cur_time
>
value
.
atime
+
60
*
10
:
...
...
product/CMFCategory/Filter.py
View file @
c11e08ba
...
@@ -75,7 +75,7 @@ class Filter(Implicit):
...
@@ -75,7 +75,7 @@ class Filter(Implicit):
return
False
return
False
if
self
.
filter_leave
and
not
self
.
_isNode
(
context
):
if
self
.
filter_leave
and
not
self
.
_isNode
(
context
):
return
False
return
False
for
k
,
v
in
s
elf
.
filter_dict
.
items
(
):
for
k
,
v
in
s
ix
.
iteritems
(
self
.
filter_dict
):
if
type
(
v
)
in
(
type
([]),
type
(())):
if
type
(
v
)
in
(
type
([]),
type
(())):
if
context
.
getProperty
(
k
)
not
in
v
:
if
context
.
getProperty
(
k
)
not
in
v
:
return
False
return
False
...
...
product/DeadlockDebugger/dumper.py
View file @
c11e08ba
...
@@ -39,7 +39,7 @@ def dump_threads():
...
@@ -39,7 +39,7 @@ def dump_threads():
this_thread_id
=
thread
.
get_ident
()
this_thread_id
=
thread
.
get_ident
()
now
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
now
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
res
=
[
"Threads traceback dump at %s
\
n
"
%
now
]
res
=
[
"Threads traceback dump at %s
\
n
"
%
now
]
for
thread_id
,
frame
in
_current_frames
().
iteritems
(
):
for
thread_id
,
frame
in
six
.
iteritems
(
_current_frames
()
):
if
thread_id
==
this_thread_id
:
if
thread_id
==
this_thread_id
:
continue
continue
...
...
product/ERP5/Document/BusinessTemplate.py
View file @
c11e08ba
This diff is collapsed.
Click to expand it.
product/ERP5/Document/Resource.py
View file @
c11e08ba
...
@@ -945,7 +945,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
...
@@ -945,7 +945,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
uid
=
self
.
getUid
()
uid
=
self
.
getUid
()
row_list
=
[]
row_list
=
[]
for
unit_uid
,
value
in
s
elf
.
_getQuantityUnitDefinitionDict
().
iteritems
(
):
for
unit_uid
,
value
in
s
ix
.
iteritems
(
self
.
_getQuantityUnitDefinitionDict
()
):
definition_uid
,
quantity
=
value
definition_uid
,
quantity
=
value
row_list
.
append
(
dict
(
uid
=
definition_uid
,
row_list
.
append
(
dict
(
uid
=
definition_uid
,
resource_uid
=
uid
,
resource_uid
=
uid
,
...
@@ -977,7 +977,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
...
@@ -977,7 +977,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
metric_type_map
[
metric_type
]
=
measure
metric_type_map
[
metric_type
]
=
measure
insert_list
=
[]
insert_list
=
[]
for
measure
in
metric_type_map
.
itervalues
(
):
for
measure
in
six
.
itervalues
(
metric_type_map
):
if
measure
is
not
None
:
if
measure
is
not
None
:
insert_list
+=
measure
.
asCatalogRowList
(
quantity_unit_definition_dict
)
insert_list
+=
measure
.
asCatalogRowList
(
quantity_unit_definition_dict
)
...
...
product/ERP5/ERP5Site.py
View file @
c11e08ba
...
@@ -2492,7 +2492,7 @@ def initialize(self):
...
@@ -2492,7 +2492,7 @@ def initialize(self):
REQUEST
.
RESPONSE
.
unauthorized
()
REQUEST
.
RESPONSE
.
unauthorized
()
newSecurityManager
(
None
,
user
.
__of__
(
uf
))
newSecurityManager
(
None
,
user
.
__of__
(
uf
))
manage_addERP5Site
(
app
.
__of__
(
RequestContainer
(
REQUEST
=
REQUEST
)),
manage_addERP5Site
(
app
.
__of__
(
RequestContainer
(
REQUEST
=
REQUEST
)),
**
{
k
:
kw
.
get
(
k
,
v
)
for
k
,
v
in
default_kw
.
iteritems
(
)
**
{
k
:
kw
.
get
(
k
,
v
)
for
k
,
v
in
six
.
iteritems
(
default_kw
)
if
isinstance
(
v
,
str
)})
if
isinstance
(
v
,
str
)})
transaction
.
get
().
note
(
'Created '
+
meta_type
)
transaction
.
get
().
note
(
'Created '
+
meta_type
)
transaction
.
commit
()
transaction
.
commit
()
...
...
product/ERP5/Extensions/Diff.py
View file @
c11e08ba
...
@@ -70,7 +70,7 @@ def diff_objects(object_a, object_b):
...
@@ -70,7 +70,7 @@ def diff_objects(object_a, object_b):
for
property_dict_id
in
(
'values'
,
'tales'
,
'overrides'
):
for
property_dict_id
in
(
'values'
,
'tales'
,
'overrides'
):
a_property_dict
=
getattr
(
field_a
,
property_dict_id
)
a_property_dict
=
getattr
(
field_a
,
property_dict_id
)
b_property_dict
=
getattr
(
field_b
,
property_dict_id
)
b_property_dict
=
getattr
(
field_b
,
property_dict_id
)
for
property_id
,
a_property_value
in
a_property_dict
.
iteritems
(
):
for
property_id
,
a_property_value
in
six
.
iteritems
(
a_property_dict
):
b_property_value
=
b_property_dict
[
property_id
]
b_property_value
=
b_property_dict
[
property_id
]
if
a_property_value
!=
b_property_value
:
if
a_property_value
!=
b_property_value
:
if
isinstance
(
a_property_value
,
str
)
and
isinstance
(
b_property_value
,
str
):
if
isinstance
(
a_property_value
,
str
)
and
isinstance
(
b_property_value
,
str
):
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Amount.py
View file @
c11e08ba
...
@@ -121,7 +121,7 @@ class Amount(Base, VariatedMixin):
...
@@ -121,7 +121,7 @@ class Amount(Base, VariatedMixin):
render_category_list
=
Renderer
(
display_id
=
display_id
,
**
kw
).
render
render_category_list
=
Renderer
(
display_id
=
display_id
,
**
kw
).
render
kw
[
'display_id'
]
=
'title'
kw
[
'display_id'
]
=
'title'
for
base_category
,
(
object_list
,
for
base_category
,
(
object_list
,
category_list
)
in
variation_dict
.
iteritems
(
):
category_list
)
in
six
.
iteritems
(
variation_dict
):
if
base_category_list
and
base_category
not
in
base_category_list
:
if
base_category_list
and
base_category
not
in
base_category_list
:
continue
continue
variation_category_item_list
+=
render_category_list
(
category_list
)
variation_category_item_list
+=
render_category_list
(
category_list
)
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.AppliedRule.py
View file @
c11e08ba
...
@@ -230,7 +230,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -230,7 +230,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
sm_dict
=
old_dict
.
setdefault
(
line
,
{})
sm_dict
=
old_dict
.
setdefault
(
line
,
{})
recurse_list
=
deque
(({
get_matching_key
(
sm
):
(
sm
,)},))
recurse_list
=
deque
(({
get_matching_key
(
sm
):
(
sm
,)},))
while
recurse_list
:
while
recurse_list
:
for
k
,
x
in
recurse_list
.
popleft
().
iteritems
(
):
for
k
,
x
in
six
.
iteritems
(
recurse_list
.
popleft
()
):
if
not
k
:
if
not
k
:
continue
continue
if
len
(
x
)
>
1
:
if
len
(
x
)
>
1
:
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.py
View file @
c11e08ba
...
@@ -869,7 +869,7 @@ class BusinessProcess(Path, XMLObject):
...
@@ -869,7 +869,7 @@ class BusinessProcess(Path, XMLObject):
if
trade_phase_list
:
# reduce graph
if
trade_phase_list
:
# reduce graph
next_dict
=
defaultdict
(
set
)
next_dict
=
defaultdict
(
set
)
# build {phase: next_set} (i.e. reverse result)
# build {phase: next_set} (i.e. reverse result)
for
next_
,
phase_set
in
result
.
iteritems
(
):
for
next_
,
phase_set
in
six
.
iteritems
(
result
):
for
phase
in
phase_set
:
for
phase
in
phase_set
:
next_dict
[
phase
].
add
(
next_
)
next_dict
[
phase
].
add
(
next_
)
# for each phase to remove
# for each phase to remove
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.ContributionPredicate.py
View file @
c11e08ba
...
@@ -73,9 +73,9 @@ class ContributionPredicate(Predicate, XMLObject):
...
@@ -73,9 +73,9 @@ class ContributionPredicate(Predicate, XMLObject):
if
getattr
(
aq_base
(
self
),
'_identity_criterion'
,
None
)
is
None
:
if
getattr
(
aq_base
(
self
),
'_identity_criterion'
,
None
)
is
None
:
self
.
_identity_criterion
=
{}
self
.
_identity_criterion
=
{}
self
.
_range_criterion
=
{}
self
.
_range_criterion
=
{}
for
property_
,
value
in
s
elf
.
_identity_criterion
.
iteritems
(
):
for
property_
,
value
in
s
ix
.
iteritems
(
self
.
_identity_criterion
):
result
=
result
and
(
context
.
getProperty
(
property_
)
in
value
)
result
=
result
and
(
context
.
getProperty
(
property_
)
in
value
)
for
property_
,
(
min_
,
max_
)
in
s
elf
.
_range_criterion
.
iteritems
(
):
for
property_
,
(
min_
,
max_
)
in
s
ix
.
iteritems
(
self
.
_range_criterion
):
value
=
context
.
getProperty
(
property_
)
value
=
context
.
getProperty
(
property_
)
if
min_
is
not
None
:
if
min_
is
not
None
:
result
=
result
and
(
value
>=
min_
)
result
=
result
and
(
value
>=
min_
)
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.SimulationMovement.py
View file @
c11e08ba
...
@@ -673,7 +673,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
...
@@ -673,7 +673,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
path_set_to_check):
path_set_to_check):
yield d
yield d
for id_, t in
tree_node.visited_movement_dict.iteritems(
):
for id_, t in
six.iteritems(tree_node.visited_movement_dict
):
subdocument, path = t
subdocument, path = t
to_check = path_set_to_check
to_check = path_set_to_check
# do we need to change/copy the set?
# do we need to change/copy the set?
...
...
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.AmountGeneratorMixin.py
View file @
c11e08ba
...
@@ -415,7 +415,7 @@ class AmountGeneratorMixin:
...
@@ -415,7 +415,7 @@ class AmountGeneratorMixin:
del
cell_aggregate
[
self_key
]
del
cell_aggregate
[
self_key
]
# Allow base_application & base_contribution to be variated.
# Allow base_application & base_contribution to be variated.
for
property_dict
in
cell_aggregate
.
itervalues
(
):
for
property_dict
in
six
.
itervalues
(
cell_aggregate
):
base_amount_set
=
property_dict
[
'base_application_set'
]
base_amount_set
=
property_dict
[
'base_application_set'
]
variation_list
=
tuple
(
sorted
(
x
for
x
in
base_amount_set
variation_list
=
tuple
(
sorted
(
x
for
x
in
base_amount_set
if
not
x
.
startswith
(
'base_amount/'
)))
if
not
x
.
startswith
(
'base_amount/'
)))
...
@@ -481,7 +481,7 @@ class AmountGeneratorMixin:
...
@@ -481,7 +481,7 @@ class AmountGeneratorMixin:
amount
.
_setQuantity
(
quantity
)
amount
.
_setQuantity
(
quantity
)
amount
.
_setTitle
(
self
.
getTitle
())
amount
.
_setTitle
(
self
.
getTitle
())
amount
.
_setDescription
(
self
.
getDescription
())
amount
.
_setDescription
(
self
.
getDescription
())
for
x
in
property_dict
.
iteritems
(
):
for
x
in
six
.
iteritems
(
property_dict
):
amount
.
_setProperty
(
*
x
)
amount
.
_setProperty
(
*
x
)
# convert to default management unit if possible
# convert to default management unit if possible
amount
.
_setQuantity
(
amount
.
getConvertedQuantity
())
amount
.
_setQuantity
(
amount
.
getConvertedQuantity
())
...
...
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.DiscoverableMixin.py
View file @
c11e08ba
...
@@ -164,7 +164,7 @@ class DiscoverableMixin(CachedConvertableMixin):
...
@@ -164,7 +164,7 @@ class DiscoverableMixin(CachedConvertableMixin):
else
:
else
:
result
=
method
()
result
=
method
()
if
result
is
not
None
:
if
result
is
not
None
:
for
key
,
value
in
result
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
result
):
if
value
not
in
(
None
,
''
):
if
value
not
in
(
None
,
''
):
kw
[
key
]
=
value
kw
[
key
]
=
value
# Prepare the content edit parameters
# Prepare the content edit parameters
...
...
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.GeneratedAmountList.py
View file @
c11e08ba
...
@@ -87,7 +87,7 @@ class GeneratedAmountList(list):
...
@@ -87,7 +87,7 @@ class GeneratedAmountList(list):
else
:
else
:
aggregate
[
1
]
+=
amount
.
getQuantity
()
aggregate
[
1
]
+=
amount
.
getQuantity
()
from
erp5.component.document.RoundingModel
import
RoundingProxy
from
erp5.component.document.RoundingModel
import
RoundingProxy
for
amount
,
quantity
in
aggregate_dict
.
itervalues
(
):
for
amount
,
quantity
in
six
.
itervalues
(
aggregate_dict
):
# Before we ignore 'quantity==0' amount here for better performance,
# Before we ignore 'quantity==0' amount here for better performance,
# but it is not a good idea, especially when the first expand causes
# but it is not a good idea, especially when the first expand causes
# non-zero quantity and then quantity becomes zero.
# non-zero quantity and then quantity becomes zero.
...
...
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.WebDAVSupport.py
View file @
c11e08ba
...
@@ -61,7 +61,7 @@ class TextContent:
...
@@ -61,7 +61,7 @@ class TextContent:
title
=
tree
.
find
(
"head/title"
)
title
=
tree
.
find
(
"head/title"
)
if
title
is
not
None
:
if
title
is
not
None
:
headers
[
"title"
]
=
title
.
text
headers
[
"title"
]
=
title
.
text
return
{
k
:
v
if
len
(
v
)
>
1
else
v
[
0
]
for
k
,
v
in
headers
.
iteritems
(
)}
return
{
k
:
v
if
len
(
v
)
>
1
else
v
[
0
]
for
k
,
v
in
six
.
iteritems
(
headers
)}
## FTP handlers
## FTP handlers
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'PUT'
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'PUT'
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.py
View file @
c11e08ba
...
@@ -61,7 +61,7 @@ if detailed_report_result:
...
@@ -61,7 +61,7 @@ if detailed_report_result:
REQUEST
.
RESPONSE
.
setStatus
(
200
,
'OK'
,
lock
=
True
)
REQUEST
.
RESPONSE
.
setStatus
(
200
,
'OK'
,
lock
=
True
)
raise
Exception
(
'Spreadsheet contains errors'
)
raise
Exception
(
'Spreadsheet contains errors'
)
for
base_category
,
category_list
in
category_list_spreadsheet_dict
.
iteritems
(
):
for
base_category
,
category_list
in
six
.
iteritems
(
category_list_spreadsheet_dict
):
total_category_counter
+=
len
(
category_list
)
total_category_counter
+=
len
(
category_list
)
category_path_set
=
set
()
category_path_set
=
set
()
for
category
in
category_list
:
for
category
in
category_list
:
...
@@ -108,7 +108,7 @@ for base_category, category_list in category_list_spreadsheet_dict.iteritems():
...
@@ -108,7 +108,7 @@ for base_category, category_list in category_list_spreadsheet_dict.iteritems():
category_path_set
.
add
(
category_value
.
getRelativeUrl
())
category_path_set
.
add
(
category_value
.
getRelativeUrl
())
category_update_dict
=
{}
category_update_dict
=
{}
for
key
,
value
in
category
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
category
):
if
not
create_local_property
and
key
not
in
category_type_property_id_set
:
if
not
create_local_property
and
key
not
in
category_type_property_id_set
:
report
(
report
(
field_type
=
'Update'
,
field_type
=
'Update'
,
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.RuleTool.py
View file @
c11e08ba
...
@@ -143,7 +143,7 @@ class RuleTool(BaseTool):
...
@@ -143,7 +143,7 @@ class RuleTool(BaseTool):
for
m
in
message_list
:
for
m
in
message_list
:
expandable_dict
[
m
.
object
].
append
(
m
)
expandable_dict
[
m
.
object
].
append
(
m
)
try
:
try
:
for
expandable
,
message_list
in
expandable_dict
.
iteritems
(
):
for
expandable
,
message_list
in
six
.
iteritems
(
expandable_dict
):
kw
=
{}
kw
=
{}
for
m
in
message_list
:
for
m
in
message_list
:
kw
.
update
(
m
.
kw
)
kw
.
update
(
m
.
kw
)
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SimulationTool.py
View file @
c11e08ba
...
@@ -436,15 +436,14 @@ class SimulationTool(BaseTool):
...
@@ -436,15 +436,14 @@ class SimulationTool(BaseTool):
# Column values
# Column values
column_value_dict
=
new_kw
.
pop
(
'column_value_dict'
,
{})
column_value_dict
=
new_kw
.
pop
(
'column_value_dict'
,
{})
for
key
,
value
in
column_value_dict
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
column_value_dict
):
new_kw
[
'%s.%s'
%
(
table
,
key
)]
=
value
new_kw
[
'%s.%s'
%
(
table
,
key
)]
=
value
# Related keys
# Related keys
# First, the passthrough (acts as default values)
# First, the passthrough (acts as default values)
for
key
,
value
in
new_kw
.
pop
(
'related_key_dict_passthrough'
,
{})
\
for
key
,
value
in
new_kw
.
pop
(
'related_key_dict_passthrough'
,
six
.
iteritems
({})):
.
iteritems
():
new_kw
[
key
]
=
value
new_kw
[
key
]
=
value
# Second, calculated values
# Second, calculated values
for
key
,
value
in
new_kw
.
pop
(
'related_key_dict'
,
{}).
iteritems
(
):
for
key
,
value
in
new_kw
.
pop
(
'related_key_dict'
,
six
.
iteritems
({})
):
new_kw
[
'%s_%s'
%
(
table
,
key
)]
=
value
new_kw
[
'%s_%s'
%
(
table
,
key
)]
=
value
# Simulation states matched with input and output omission
# Simulation states matched with input and output omission
def
getSimulationQuery
(
simulation_dict
,
omit_dict
):
def
getSimulationQuery
(
simulation_dict
,
omit_dict
):
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslationQuery.py
View file @
c11e08ba
...
@@ -27,7 +27,7 @@ query_list = [
...
@@ -27,7 +27,7 @@ query_list = [
),
),
logical_operator
=
'and'
,
logical_operator
=
'and'
,
)
)
for
original_message
,
portal_type_set
in
original_message_dict
.
iteritems
(
)
for
original_message
,
portal_type_set
in
six
.
iteritems
(
original_message_dict
)
]
]
if
len
(
query_list
)
==
1
:
if
len
(
query_list
)
==
1
:
return
query_list
[
0
]
return
query_list
[
0
]
...
...
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
View file @
c11e08ba
...
@@ -41,7 +41,7 @@ for f in form.get_fields():
...
@@ -41,7 +41,7 @@ for f in form.get_fields():
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
if
listbox
is
not
None
:
if
listbox
is
not
None
:
listbox_line_list
=
[]
listbox_line_list
=
[]
for
key
,
value
in
s
orted
(
listbox
.
iteritems
(
)):
for
key
,
value
in
s
ix
.
iteritems
(
sorted
(
listbox
)):
value
[
'listbox_key'
]
=
key
value
[
'listbox_key'
]
=
key
listbox_line_list
.
append
(
value
)
listbox_line_list
.
append
(
value
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
...
...
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
View file @
c11e08ba
...
@@ -159,7 +159,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
...
@@ -159,7 +159,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
test_page
=
self
.
portal
.
portal_components
[
test_component_id
]
test_page
=
self
.
portal
.
portal_components
[
test_component_id
]
for
property_id
,
property_value
in
test_component_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
test_component_kw
):
self
.
assertEqual
(
test_page
.
getProperty
(
property_id
),
property_value
)
self
.
assertEqual
(
test_page
.
getProperty
(
property_id
),
property_value
)
def
test_twoFileImportExportForWebPage
(
self
):
def
test_twoFileImportExportForWebPage
(
self
):
...
@@ -211,7 +211,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
...
@@ -211,7 +211,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
(
js_file_id
,
js_document_kw
),
(
js_file_id
,
js_document_kw
),
(
css_file_id
,
css_document_kw
)]:
(
css_file_id
,
css_document_kw
)]:
web_page
=
self
.
portal
.
web_page_module
[
web_file
[
0
]]
web_page
=
self
.
portal
.
web_page_module
[
web_file
[
0
]]
for
property_id
,
property_value
in
web_file
[
1
].
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
web_file
[
1
]
):
self
.
assertEqual
(
web_page
.
getProperty
(
property_id
),
property_value
)
self
.
assertEqual
(
web_page
.
getProperty
(
property_id
),
property_value
)
def
test_twoFileImportExportForPythonScript
(
self
):
def
test_twoFileImportExportForPythonScript
(
self
):
...
@@ -275,7 +275,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
...
@@ -275,7 +275,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
import_template
.
install
()
import_template
.
install
()
image_page
=
self
.
portal
.
image_module
[
image_file_id
]
image_page
=
self
.
portal
.
image_module
[
image_file_id
]
for
property_id
,
property_value
in
image_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
image_document_kw
):
self
.
assertEqual
(
image_page
.
getProperty
(
property_id
),
property_value
)
self
.
assertEqual
(
image_page
.
getProperty
(
property_id
),
property_value
)
...
@@ -344,7 +344,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -344,7 +344,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
file_page
=
self
.
portal
.
document_module
[
file_id
]
file_page
=
self
.
portal
.
document_module
[
file_id
]
for
property_id
,
property_value
in
file_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
file_document_kw
):
self
.
assertEqual
(
getattr
(
file_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
file_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeJS
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeJS
(
self
):
...
@@ -515,7 +515,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -515,7 +515,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
file_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
test_file_id
]
file_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
test_file_id
]
for
property_id
,
property_value
in
file_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
file_document_kw
):
self
.
assertEqual
(
getattr
(
file_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
file_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForPDF
(
self
):
def
test_twoFileImportExportForPDF
(
self
):
...
@@ -570,7 +570,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -570,7 +570,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page
=
catalog
[
method_id
]
method_page
=
catalog
[
method_id
]
for
property_id
,
property_value
in
method_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
method_document_kw
):
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForERP5SQLMethodInCatalog
(
self
):
def
test_twoFileImportExportForERP5SQLMethodInCatalog
(
self
):
...
@@ -618,7 +618,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -618,7 +618,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page
=
catalog
[
method_id
]
method_page
=
catalog
[
method_id
]
for
property_id
,
property_value
in
method_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
method_document_kw
):
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForCatalogMethodInPortalSkins
(
self
):
def
test_twoFileImportExportForCatalogMethodInPortalSkins
(
self
):
...
@@ -664,7 +664,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -664,7 +664,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page
=
skin_folder
[
method_id
]
method_page
=
skin_folder
[
method_id
]
for
property_id
,
property_value
in
method_document_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
method_document_kw
):
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
method_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForZopePageTemplate
(
self
):
def
test_twoFileImportExportForZopePageTemplate
(
self
):
...
@@ -703,7 +703,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -703,7 +703,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
page_template_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
page_template_id
]
page_template_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
page_template_id
]
for
property_id
,
property_value
in
page_template_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
page_template_kw
):
self
.
assertEqual
(
getattr
(
page_template_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
page_template_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForDTMLMethodIdentifyingTypeByTitle
(
self
):
def
test_twoFileImportExportForDTMLMethodIdentifyingTypeByTitle
(
self
):
...
@@ -754,7 +754,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -754,7 +754,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
dtml_method_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
dtml_method_id
]
dtml_method_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
dtml_method_id
]
for
property_id
,
property_value
in
dtml_method_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
dtml_method_kw
):
self
.
assertEqual
(
getattr
(
dtml_method_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
dtml_method_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForDTMLMethodNotIdentifyingType
(
self
):
def
test_twoFileImportExportForDTMLMethodNotIdentifyingType
(
self
):
...
@@ -805,7 +805,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -805,7 +805,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
dtml_method_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
dtml_method_id
]
dtml_method_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
dtml_method_id
]
for
property_id
,
property_value
in
dtml_method_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
dtml_method_kw
):
self
.
assertEqual
(
getattr
(
dtml_method_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
dtml_method_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForOOoTemplate
(
self
):
def
test_twoFileImportExportForOOoTemplate
(
self
):
...
@@ -850,7 +850,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -850,7 +850,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
OOo_template_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
OOo_template_id
]
OOo_template_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
OOo_template_id
]
for
property_id
,
property_value
in
OOo_template_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
OOo_template_kw
):
self
.
assertEqual
(
getattr
(
OOo_template_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
OOo_template_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForSpreadsheetNotIdentifyingType
(
self
):
def
test_twoFileImportExportForSpreadsheetNotIdentifyingType
(
self
):
...
@@ -917,7 +917,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -917,7 +917,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
test_page
=
self
.
portal
.
test_page_module
[
test_page_id
]
test_page
=
self
.
portal
.
test_page_module
[
test_page_id
]
for
property_id
,
property_value
in
test_page_data_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
test_page_data_kw
):
self
.
assertEqual
(
getattr
(
test_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
test_page
,
property_id
),
property_value
)
def
test_twoFileImportExportForERP5PythonScript
(
self
):
def
test_twoFileImportExportForERP5PythonScript
(
self
):
...
@@ -961,7 +961,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -961,7 +961,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
python_script_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
python_script_id
]
python_script_page
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
python_script_id
]
for
property_id
,
property_value
in
python_script_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
python_script_kw
):
self
.
assertEqual
(
getattr
(
python_script_page
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
python_script_page
,
property_id
),
property_value
)
def
test_templateFolderIsCleanedUpInImportAndReexport
(
self
):
def
test_templateFolderIsCleanedUpInImportAndReexport
(
self
):
...
@@ -1129,7 +1129,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -1129,7 +1129,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
# check that the page template has the expected attributes
# check that the page template has the expected attributes
# but the installed version encoding is utf-8
# but the installed version encoding is utf-8
page_template
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
page_template_id
]
page_template
=
self
.
portal
.
portal_skins
[
skin_folder_id
][
page_template_id
]
for
property_id
,
property_value
in
page_template_kw
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
page_template_kw
):
self
.
assertEqual
(
getattr
(
page_template
,
property_id
),
property_value
)
self
.
assertEqual
(
getattr
(
page_template
,
property_id
),
property_value
)
# uninstall and export the business template
# uninstall and export the business template
...
...
product/ERP5/tests/testInventoryAPI.py
View file @
c11e08ba
...
@@ -1593,7 +1593,7 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1593,7 +1593,7 @@ class TestInventoryList(InventoryAPITestCase):
resource_uid
=
resource
.
getUid
()
resource_uid
=
resource
.
getUid
()
# create all movements
# create all movements
for
month
,
value
in
data
.
iteritems
(
):
for
month
,
value
in
six
.
iteritems
(
data
):
for
mov
in
value
[
'movement_list'
]:
for
mov
in
value
[
'movement_list'
]:
d
=
DateTime
(
'%s/15 15:00 UTC'
%
month
)
d
=
DateTime
(
'%s/15 15:00 UTC'
%
month
)
self
.
_makeMovement
(
start_date
=
d
,
resource_uid
=
resource_uid
,
**
mov
)
self
.
_makeMovement
(
start_date
=
d
,
resource_uid
=
resource_uid
,
**
mov
)
...
@@ -1618,7 +1618,7 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1618,7 +1618,7 @@ class TestInventoryList(InventoryAPITestCase):
'2011/01'
:
'2011/01'
:
dict
(
movement_list
=
[
h
(
22
,
8910
)],
after
=
h
(
291
,
133344
)),
dict
(
movement_list
=
[
h
(
22
,
8910
)],
after
=
h
(
291
,
133344
)),
}
}
for
month
,
value
in
internal_data
.
iteritems
(
):
for
month
,
value
in
six
.
iteritems
(
internal_data
):
for
mov
in
value
[
'movement_list'
]:
for
mov
in
value
[
'movement_list'
]:
d
=
DateTime
(
'%s/15 15:00 UTC'
%
month
)
d
=
DateTime
(
'%s/15 15:00 UTC'
%
month
)
self
.
_makeMovement
(
is_internal
=
1
,
start_date
=
d
,
resource_uid
=
resource_uid
,
**
mov
)
self
.
_makeMovement
(
is_internal
=
1
,
start_date
=
d
,
resource_uid
=
resource_uid
,
**
mov
)
...
@@ -2764,8 +2764,8 @@ class TestTrackingList(InventoryAPITestCase):
...
@@ -2764,8 +2764,8 @@ class TestTrackingList(InventoryAPITestCase):
node_1_uid
:
1
,
node_1_uid
:
1
,
node_2_uid
:
2
node_2_uid
:
2
}
}
for
date
,
location_dict
in
date_location_dict
.
iteritems
(
):
for
date
,
location_dict
in
six
.
iteritems
(
date_location_dict
):
for
param_id
,
location_uid
in
location_dict
.
iteritems
(
):
for
param_id
,
location_uid
in
six
.
iteritems
(
location_dict
):
param_dict
=
{
param_id
:
date
}
param_dict
=
{
param_id
:
date
}
uid_list
=
[
x
.
node_uid
for
x
in
getTrackingList
(
uid_list
=
[
x
.
node_uid
for
x
in
getTrackingList
(
aggregate_uid
=
self
.
item
.
getUid
(),
**
param_dict
)]
aggregate_uid
=
self
.
item
.
getUid
(),
**
param_dict
)]
...
@@ -2945,7 +2945,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -2945,7 +2945,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
True: all values from criterion_dict match given inventory_line.
True: all values from criterion_dict match given inventory_line.
False otherwise.
False otherwise.
"""
"""
for
criterion_id
,
criterion_value
in
criterion_dict
.
iteritems
(
):
for
criterion_id
,
criterion_value
in
six
.
iteritems
(
criterion_dict
):
if
criterion_id
not
in
inventory_line
\
if
criterion_id
not
in
inventory_line
\
or
criterion_value
!=
inventory_line
[
criterion_id
]:
or
criterion_value
!=
inventory_line
[
criterion_id
]:
return
False
return
False
...
@@ -3733,7 +3733,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
...
@@ -3733,7 +3733,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
def
setUpUnitDefinition
(
self
):
def
setUpUnitDefinition
(
self
):
unit_module
=
self
.
portal
.
quantity_unit_conversion_module
unit_module
=
self
.
portal
.
quantity_unit_conversion_module
for
base
,
t
in
s
elf
.
QUANTITY_UNIT_DICT
.
iteritems
(
):
for
base
,
t
in
s
ix
.
iteritems
(
self
.
QUANTITY_UNIT_DICT
):
standard
,
definition_dict
=
t
standard
,
definition_dict
=
t
group
=
unit_module
.
_getOb
(
base
,
None
)
group
=
unit_module
.
_getOb
(
base
,
None
)
...
@@ -3745,7 +3745,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
...
@@ -3745,7 +3745,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
if
group
.
getValidationState
()
in
(
'draft'
,
'invalidated'
):
if
group
.
getValidationState
()
in
(
'draft'
,
'invalidated'
):
group
.
validate
()
group
.
validate
()
for
unit
,
amount
in
definition_dict
.
iteritems
(
):
for
unit
,
amount
in
six
.
iteritems
(
definition_dict
):
definition
=
group
.
_getOb
(
unit
,
None
)
definition
=
group
.
_getOb
(
unit
,
None
)
if
definition
is
None
:
if
definition
is
None
:
definition
=
group
.
newContent
(
definition
=
group
.
newContent
(
...
@@ -3776,7 +3776,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
...
@@ -3776,7 +3776,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
def
getNeededCategoryList
(
self
):
def
getNeededCategoryList
(
self
):
category_list
=
[
'metric_type/'
+
c
for
c
in
self
.
METRIC_TYPE_CATEGORY_LIST
]
category_list
=
[
'metric_type/'
+
c
for
c
in
self
.
METRIC_TYPE_CATEGORY_LIST
]
for
base
,
t
in
s
elf
.
QUANTITY_UNIT_DICT
.
iteritems
(
):
for
base
,
t
in
s
ix
.
iteritems
(
self
.
QUANTITY_UNIT_DICT
):
standard
,
definition_dict
=
t
standard
,
definition_dict
=
t
quantity
=
'quantity_unit/%s/'
%
base
quantity
=
'quantity_unit/%s/'
%
base
...
...
product/ERP5/tests/testSpellChecking.py
View file @
c11e08ba
...
@@ -113,8 +113,8 @@ class TestSpellChecking(ERP5TypeTestCase):
...
@@ -113,8 +113,8 @@ class TestSpellChecking(ERP5TypeTestCase):
"""
"""
message
=
'"%s" is misspelled, suggestion are : "%s"'
message
=
'"%s" is misspelled, suggestion are : "%s"'
result_dict
=
{}
result_dict
=
{}
for
word
,
result_list
in
s
elf
.
spellChecker
(
sentence
).
iteritems
(
):
for
word
,
result_list
in
s
ix
.
iteritems
(
self
.
spellChecker
(
sentence
)
):
filtered_result_list
=
filter
(
lambda
x
:
x
not
in
(
'*'
,
''
),
result_list
)
filtered_result_list
=
[
x
for
x
in
result_list
if
x
not
in
(
'*'
,
''
)]
if
filtered_result_list
:
if
filtered_result_list
:
result_dict
[
word
]
=
message
%
(
word
,
\
result_dict
[
word
]
=
message
%
(
word
,
\
filtered_result_list
[
0
].
split
(
':'
)[
-
1
].
strip
())
filtered_result_list
[
0
].
split
(
':'
)[
-
1
].
strip
())
...
...
product/ERP5/tests/utils.py
View file @
c11e08ba
...
@@ -109,7 +109,7 @@ class BusinessTemplateInfoBase:
...
@@ -109,7 +109,7 @@ class BusinessTemplateInfoBase:
def
parse
(
file_path
):
def
parse
(
file_path
):
action_information
=
importXML
(
connection
,
file_path
)
action_information
=
importXML
(
connection
,
file_path
)
action_information
.
__repr__
()
action_information
.
__repr__
()
for
key
,
value
in
action_information
.
__dict__
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
action_information
.
__dict__
):
if
value
not
in
(
None
,
""
)
and
key
in
(
'action'
,
'condition'
)
:
if
value
not
in
(
None
,
""
)
and
key
in
(
'action'
,
'condition'
)
:
setattr
(
action_information
,
key
,
value
.
text
)
setattr
(
action_information
,
key
,
value
.
text
)
actions
=
action_information
.
__dict__
.
copy
()
actions
=
action_information
.
__dict__
.
copy
()
...
...
product/ERP5Catalog/CatalogTool.py
View file @
c11e08ba
...
@@ -112,7 +112,7 @@ class IndexableObjectWrapper(object):
...
@@ -112,7 +112,7 @@ class IndexableObjectWrapper(object):
skip_role_set
=
set
()
skip_role_set
=
set
()
skip_role
=
skip_role_set
.
add
skip_role
=
skip_role_set
.
add
clear_skip_role
=
skip_role_set
.
clear
clear_skip_role
=
skip_role_set
.
clear
for
group_id
,
role_list
in
mergedLocalRoles
(
ob
).
iteritems
(
):
for
group_id
,
role_list
in
six
.
iteritems
(
mergedLocalRoles
(
ob
)
):
new_role_list
=
[]
new_role_list
=
[]
new_role
=
new_role_list
.
append
new_role
=
new_role_list
.
append
clear_skip_role
()
clear_skip_role
()
...
@@ -142,7 +142,7 @@ class IndexableObjectWrapper(object):
...
@@ -142,7 +142,7 @@ class IndexableObjectWrapper(object):
no_indexable_role
=
self
.
__catalog_role_set
.
isdisjoint
no_indexable_role
=
self
.
__catalog_role_set
.
isdisjoint
return
(
return
(
group_id
group_id
for
group_id
,
role_list
in
s
elf
.
__getLocalRoleDict
().
iteritems
(
)
for
group_id
,
role_list
in
s
ix
.
iteritems
(
self
.
__getLocalRoleDict
()
)
if
group_id
not
in
self
.
__user_set
and
if
group_id
not
in
self
.
__user_set
and
# group_id is returned only if any of its roles is indexable
# group_id is returned only if any of its roles is indexable
not
no_indexable_role
(
role_list
)
not
no_indexable_role
(
role_list
)
...
@@ -197,7 +197,7 @@ class IndexableObjectWrapper(object):
...
@@ -197,7 +197,7 @@ class IndexableObjectWrapper(object):
''
:
allowed_role_set
,
''
:
allowed_role_set
,
}
}
optimized_role_set
=
set
()
optimized_role_set
=
set
()
for
role_definition_group
,
user_and_role_list
in
local_roles_group_id_dict
.
iteritems
(
):
for
role_definition_group
,
user_and_role_list
in
six
.
iteritems
(
local_roles_group_id_dict
):
group_allowed_set
=
allowed_by_local_roles_group_id
.
setdefault
(
group_allowed_set
=
allowed_by_local_roles_group_id
.
setdefault
(
role_definition_group
,
role_definition_group
,
set
(),
set
(),
...
@@ -212,7 +212,7 @@ class IndexableObjectWrapper(object):
...
@@ -212,7 +212,7 @@ class IndexableObjectWrapper(object):
user_view_permission_role_dict
=
{}
user_view_permission_role_dict
=
{}
catalog_role_set
=
self
.
__catalog_role_set
catalog_role_set
=
self
.
__catalog_role_set
user_set
=
self
.
__user_set
user_set
=
self
.
__user_set
for
group_id
,
role_list
in
s
elf
.
__getLocalRoleDict
().
iteritems
(
):
for
group_id
,
role_list
in
s
ix
.
iteritems
(
self
.
__getLocalRoleDict
()
):
# Warning: only valid when group_id is candidate for indexation in a
# Warning: only valid when group_id is candidate for indexation in a
# catalog_role column !
# catalog_role column !
group_id_is_user
=
group_id
in
user_set
group_id_is_user
=
group_id
in
user_set
...
@@ -239,7 +239,7 @@ class IndexableObjectWrapper(object):
...
@@ -239,7 +239,7 @@ class IndexableObjectWrapper(object):
group_allowed_set
.
add
(
prefix
+
':'
+
role
)
group_allowed_set
.
add
(
prefix
+
':'
+
role
)
# sort and freeze `allowed` principals
# sort and freeze `allowed` principals
for
local_roles_group_id
,
allowed
in
allowed_by_local_roles_group_id
.
iteritems
(
):
for
local_roles_group_id
,
allowed
in
six
.
iteritems
(
allowed_by_local_roles_group_id
):
allowed_by_local_roles_group_id
[
local_roles_group_id
]
=
tuple
(
sorted
(
allowed
))
allowed_by_local_roles_group_id
[
local_roles_group_id
]
=
tuple
(
sorted
(
allowed
))
self
.
__security_parameter_cache
=
result
=
(
self
.
__security_parameter_cache
=
result
=
(
...
@@ -758,11 +758,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -758,11 +758,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
)
)
query_list
=
[]
query_list
=
[]
append
=
query_list
.
append
append
=
query_list
.
append
for
key
,
value
in
role_column_dict
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
role_column_dict
):
append
(
SimpleQuery
(
**
{
key
:
value
}))
append
(
SimpleQuery
(
**
{
key
:
value
}))
if
security_uid_dict
:
if
security_uid_dict
:
catalog_security_uid_groups_columns_dict
=
self
.
getSQLCatalog
().
getSQLCatalogSecurityUidGroupsColumnsDict
()
catalog_security_uid_groups_columns_dict
=
self
.
getSQLCatalog
().
getSQLCatalogSecurityUidGroupsColumnsDict
()
for
local_roles_group_id
,
security_uid_list
in
s
ecurity_uid_dict
.
iteritems
(
):
for
local_roles_group_id
,
security_uid_list
in
s
ix
.
iteritems
(
security_uid_dict
):
assert
security_uid_list
assert
security_uid_list
append
(
SimpleQuery
(
append
(
SimpleQuery
(
**
{
catalog_security_uid_groups_columns_dict
[
local_roles_group_id
]:
security_uid_list
}
**
{
catalog_security_uid_groups_columns_dict
[
local_roles_group_id
]:
security_uid_list
}
...
@@ -941,7 +941,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -941,7 +941,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security_uid_dict
,
security_uid_dict
,
w
.
optimised_roles_and_users
,
w
.
optimised_roles_and_users
,
)
=
getSecurityUidDict
(
document_w
)
)
=
getSecurityUidDict
(
document_w
)
for
local_roles_group_id
,
security_uid
in
s
ecurity_uid_dict
.
iteritems
(
):
for
local_roles_group_id
,
security_uid
in
s
ix
.
iteritems
(
security_uid_dict
):
catalog_column
=
catalog_security_uid_groups_columns_dict
.
get
(
catalog_column
=
catalog_security_uid_groups_columns_dict
.
get
(
local_roles_group_id
,
local_roles_group_id
,
default_security_uid_column
,
default_security_uid_column
,
...
@@ -1207,7 +1207,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -1207,7 +1207,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
suffix
=
(
''
if
forward
else
'__related'
)
+
'__uid'
suffix
=
(
''
if
forward
else
'__related'
)
+
'__uid'
parent_document_set
=
base_category_dict
.
pop
(
'parent'
,
None
)
parent_document_set
=
base_category_dict
.
pop
(
'parent'
,
None
)
query_list
=
[]
query_list
=
[]
for
base_category_id
,
document_set
in
base_category_dict
.
iteritems
(
):
for
base_category_id
,
document_set
in
six
.
iteritems
(
base_category_dict
):
column
=
prefix
+
base_category_id
+
suffix
column
=
prefix
+
base_category_id
+
suffix
category_query
=
SimpleQuery
(
**
{
category_query
=
SimpleQuery
(
**
{
column
:
{
document
.
getUid
()
for
document
in
document_set
},
column
:
{
document
.
getUid
()
for
document
in
document_set
},
...
...
product/ERP5Catalog/Document/ERP5Catalog.py
View file @
c11e08ba
...
@@ -114,7 +114,7 @@ class FilterDict(object):
...
@@ -114,7 +114,7 @@ class FilterDict(object):
def
__setitem__
(
self
,
key
,
item
):
def
__setitem__
(
self
,
key
,
item
):
filter_
=
self
[
key
]
filter_
=
self
[
key
]
for
k
,
v
in
item
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
item
):
filter_
[
k
]
=
v
filter_
[
k
]
=
v
def
get
(
self
,
key
,
default
=
None
):
def
get
(
self
,
key
,
default
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment