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
Nikola Balog
erp5
Commits
576a7b2a
Commit
576a7b2a
authored
Oct 14, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Feb 01, 2024
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
65db8731
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 @
576a7b2a
...
@@ -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
...
@@ -1039,7 +1040,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1039,7 +1040,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
]
...
@@ -1086,7 +1087,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1086,7 +1087,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
:
...
@@ -1098,7 +1099,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1098,7 +1099,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
:
...
@@ -1159,7 +1160,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
...
@@ -1159,7 +1160,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 @
576a7b2a
...
@@ -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