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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
215142b3
Commit
215142b3
authored
Oct 14, 2022
by
Kazuhiko Shiozaki
Committed by
Arnaud Fontaine
Mar 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: explicitly cast dict.items() to list when we delete an item in the loop.
parent
c41575bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+5
-4
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+2
-3
No files found.
product/ERP5Form/Form.py
View file @
215142b3
...
@@ -55,6 +55,7 @@ from zExceptions import Forbidden
...
@@ -55,6 +55,7 @@ from zExceptions import Forbidden
from
Products.ERP5Type.PsycoWrapper
import
psyco
from
Products.ERP5Type.PsycoWrapper
import
psyco
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.Utils
import
ensure_list
class
FieldValueCacheDict
(
dict
):
class
FieldValueCacheDict
(
dict
):
_last_sync
=
-
1
_last_sync
=
-
1
...
@@ -1040,7 +1041,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1040,7 +1041,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
return
a
==
b
return
a
==
b
def
remove_same_value
(
new_dict
,
target_dict
):
def
remove_same_value
(
new_dict
,
target_dict
):
for
key
,
value
in
new_dict
.
items
(
):
for
key
,
value
in
ensure_list
(
new_dict
.
items
()
):
target_value
=
target_dict
.
get
(
key
)
target_value
=
target_dict
.
get
(
key
)
if
force_delegate
or
is_equal
(
value
,
target_value
):
if
force_delegate
or
is_equal
(
value
,
target_value
):
del
new_dict
[
key
]
del
new_dict
[
key
]
...
@@ -1087,7 +1088,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1087,7 +1088,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
getFieldDict
(
target_field
,
'tales'
))
getFieldDict
(
target_field
,
'tales'
))
if
target_field
.
meta_type
==
'ProxyField'
:
if
target_field
.
meta_type
==
'ProxyField'
:
for
i
in
new_values
.
keys
(
):
for
i
in
ensure_list
(
new_values
.
keys
()
):
if
not
i
in
target_field
.
delegated_list
:
if
not
i
in
target_field
.
delegated_list
:
# obsolete variable check
# obsolete variable check
try
:
try
:
...
@@ -1099,7 +1100,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1099,7 +1100,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
if
is_equal
(
target_field
.
get_recursive_orig_value
(
i
),
if
is_equal
(
target_field
.
get_recursive_orig_value
(
i
),
new_values
[
i
]):
new_values
[
i
]):
del
new_values
[
i
]
del
new_values
[
i
]
for
i
in
new_tales
.
keys
(
):
for
i
in
ensure_list
(
new_tales
.
keys
()
):
if
not
i
in
target_field
.
delegated_list
:
if
not
i
in
target_field
.
delegated_list
:
# obsolete variable check
# obsolete variable check
try
:
try
:
...
@@ -1160,7 +1161,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1160,7 +1161,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
return
a
==
b
return
a
==
b
def
remove_same_value
(
new_dict
,
target_dict
):
def
remove_same_value
(
new_dict
,
target_dict
):
for
key
,
value
in
new_dict
.
items
(
):
for
key
,
value
in
ensure_list
(
new_dict
.
items
()
):
target_value
=
target_dict
.
get
(
key
)
target_value
=
target_dict
.
get
(
key
)
if
is_equal
(
value
,
target_value
):
if
is_equal
(
value
,
target_value
):
del
new_dict
[
key
]
del
new_dict
[
key
]
...
...
product/ERP5Form/ListBox.py
View file @
215142b3
...
@@ -38,8 +38,7 @@ from Products.Formulator.Field import ZMIField
...
@@ -38,8 +38,7 @@ from Products.Formulator.Field import ZMIField
from
Products.Formulator.Errors
import
FormValidationError
,
ValidationError
from
Products.Formulator.Errors
import
FormValidationError
,
ValidationError
from
.Selection
import
Selection
,
DomainSelection
from
.Selection
import
Selection
,
DomainSelection
from
.Tool.SelectionTool
import
createFolderMixInPageSelectionMethod
from
.Tool.SelectionTool
import
createFolderMixInPageSelectionMethod
from
Products.ERP5Type.Utils
import
getPath
from
Products.ERP5Type.Utils
import
UpperCase
,
ensure_list
,
getPath
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Document
import
newTempBase
from
Products.ERP5Type.Document
import
newTempBase
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.ZSQLCatalog.zsqlbrain
import
ZSQLBrain
from
Products.ZSQLCatalog.zsqlbrain
import
ZSQLBrain
...
@@ -106,7 +105,7 @@ class CatalogMethodWrapper(MethodWrapper):
...
@@ -106,7 +105,7 @@ class CatalogMethodWrapper(MethodWrapper):
# XXX: I'm not sure if this filtering really belongs to here.
# XXX: I'm not sure if this filtering really belongs to here.
# It is probably needed at a more generic level (Forms ? Selection ?), or
# It is probably needed at a more generic level (Forms ? Selection ?), or
# even a more specific one (limited to HTML ?)...
# even a more specific one (limited to HTML ?)...
for
key
,
value
in
kw
.
items
(
):
for
key
,
value
in
ensure_list
(
kw
.
items
()
):
if
value
==
''
:
if
value
==
''
:
kw
.
pop
(
key
)
kw
.
pop
(
key
)
return
getattr
(
self
.
context
,
self
.
method_name
)(
*
args
,
**
kw
)
return
getattr
(
self
.
context
,
self
.
method_name
)(
*
args
,
**
kw
)
...
...
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