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
0e9a49de
Commit
0e9a49de
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Form/Selection: fix python3 compatibility
parent
bb32fc85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
product/ERP5Form/Selection.py
product/ERP5Form/Selection.py
+9
-9
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+3
-3
No files found.
product/ERP5Form/Selection.py
View file @
0e9a49de
...
@@ -134,9 +134,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -134,9 +134,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
if
uids
is
None
:
uids
=
[]
if
uids
is
None
:
uids
=
[]
if
columns
is
None
:
columns
=
[]
if
columns
is
None
:
columns
=
[]
if
checked_uids
is
None
:
checked_uids
=
[]
if
checked_uids
is
None
:
checked_uids
=
[]
if
six
.
PY2
and
isinstance
(
method_path
,
six
.
text_type
):
# XXX Because method_path is an URI, it must be in ASCII.
# XXX Because method_path is an URI, it must be in ASCII.
# Shouldn't Zope automatically does this conversion? -yo
# Shouldn't Zope automatically does this conversion? -yo
if
type
(
method_path
)
is
type
(
u'a'
):
method_path
=
method_path
.
encode
(
'ascii'
)
method_path
=
method_path
.
encode
(
'ascii'
)
self
.
method_path
=
method_path
self
.
method_path
=
method_path
self
.
params
=
params
self
.
params
=
params
...
@@ -171,9 +171,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -171,9 +171,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
if
kw
is
not
None
:
if
kw
is
not
None
:
for
k
,
v
in
six
.
iteritems
(
kw
):
for
k
,
v
in
six
.
iteritems
(
kw
):
if
k
in
(
'domain'
,
'report'
,
'domain_path'
,
'report_path'
,
'domain_list'
,
'report_list'
)
or
v
is
not
None
:
if
k
in
(
'domain'
,
'report'
,
'domain_path'
,
'report_path'
,
'domain_list'
,
'report_list'
)
or
v
is
not
None
:
if
six
.
PY2
and
k
==
'method_path'
and
isinstance
(
v
,
six
.
text_type
):
# XXX Because method_path is an URI, it must be in ASCII.
# XXX Because method_path is an URI, it must be in ASCII.
# Shouldn't Zope automatically does this conversion? -yo
# Shouldn't Zope automatically does this conversion? -yo
if
k
==
'method_path'
and
isinstance
(
v
,
six
.
text_type
):
v
=
v
.
encode
(
'ascii'
)
v
=
v
.
encode
(
'ascii'
)
if
getattr
(
self
,
k
,
None
)
!=
v
:
if
getattr
(
self
,
k
,
None
)
!=
v
:
setattr
(
self
,
k
,
v
)
setattr
(
self
,
k
,
v
)
...
@@ -214,12 +214,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -214,12 +214,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
kw
.
setdefault
(
"ignore_unknown_columns"
,
True
)
kw
.
setdefault
(
"ignore_unknown_columns"
,
True
)
# Always remove '-C'-named parameter.
# Always remove '-C'-named parameter.
kw
.
pop
(
'-C'
,
None
)
kw
.
pop
(
'-C'
,
None
)
if
self
.
invert_mode
is
not
0
:
if
self
.
invert_mode
:
kw
[
'uid'
]
=
self
.
uids
kw
[
'uid'
]
=
self
.
uids
if
method
is
None
or
isinstance
(
method
,
str
):
if
method
is
None
or
isinstance
(
method
,
str
):
method_path
=
method
or
self
.
method_path
method_path
=
method
or
self
.
method_path
method
=
context
.
unrestrictedTraverse
(
method_path
)
method
=
context
.
unrestrictedTraverse
(
method_path
)
if
type
(
method
)
is
type
(
'a'
):
if
isinstance
(
method
,
str
):
method
=
context
.
unrestrictedTraverse
(
self
.
method_path
)
method
=
context
.
unrestrictedTraverse
(
self
.
method_path
)
sort_on
=
getattr
(
self
,
'sort_on'
,
[])
sort_on
=
getattr
(
self
,
'sort_on'
,
[])
if
len
(
sort_on
)
==
0
:
if
len
(
sort_on
)
==
0
:
...
@@ -339,7 +339,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -339,7 +339,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
def
getZoom
(
self
):
def
getZoom
(
self
):
try
:
try
:
current_zoom
=
self
.
params
[
'zoom'
]
current_zoom
=
self
.
params
[
'zoom'
]
if
current_zoom
!=
None
:
if
current_zoom
is
not
None
:
return
current_zoom
return
current_zoom
else
:
else
:
return
1
return
1
...
...
product/ERP5Form/Tool/SelectionTool.py
View file @
0e9a49de
...
@@ -457,7 +457,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -457,7 +457,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
int
(
uid
)
in
selection_uid_dict
:
del
selection_uid_dict
[
int
(
uid
)]
if
int
(
uid
)
in
selection_uid_dict
:
del
selection_uid_dict
[
int
(
uid
)]
except
(
ValueError
,
TypeError
):
except
(
ValueError
,
TypeError
):
if
uid
in
selection_uid_dict
:
del
selection_uid_dict
[
uid
]
if
uid
in
selection_uid_dict
:
del
selection_uid_dict
[
uid
]
self
.
setSelectionCheckedUidsFor
(
list_selection_name
,
selection_uid_dict
.
keys
(
),
REQUEST
=
REQUEST
)
self
.
setSelectionCheckedUidsFor
(
list_selection_name
,
ensure_list
(
selection_uid_dict
.
keys
()
),
REQUEST
=
REQUEST
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
_redirectToOriginalForm
(
REQUEST
=
REQUEST
,
form_id
=
form_id
,
return
self
.
_redirectToOriginalForm
(
REQUEST
=
REQUEST
,
form_id
=
form_id
,
query_string
=
query_string
,
no_reset
=
True
)
query_string
=
query_string
,
no_reset
=
True
)
...
@@ -1539,7 +1539,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -1539,7 +1539,7 @@ class SelectionTool( BaseTool, SimpleItem ):
def
_getSelectionNameListFromContainer
(
self
):
def
_getSelectionNameListFromContainer
(
self
):
user_id
=
self
.
_getUserId
()
user_id
=
self
.
_getUserId
()
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
list
(
self
.
getTemporarySelectionDict
().
keys
())))
ensure_
list
(
self
.
getTemporarySelectionDict
().
keys
())))
def
isAnonymous
(
self
):
def
isAnonymous
(
self
):
return
self
.
_getUserId
()
==
'Anonymous User'
return
self
.
_getUserId
()
==
'Anonymous User'
...
@@ -1604,7 +1604,7 @@ class TransactionalCacheContainer(MemcachedContainer):
...
@@ -1604,7 +1604,7 @@ class TransactionalCacheContainer(MemcachedContainer):
class
PersistentMappingContainer
(
BaseContainer
):
class
PersistentMappingContainer
(
BaseContainer
):
def
getSelectionNameList
(
self
,
user_id
):
def
getSelectionNameList
(
self
,
user_id
):
try
:
try
:
return
self
.
_container
[
user_id
].
keys
(
)
return
ensure_list
(
self
.
_container
[
user_id
].
keys
()
)
except
KeyError
:
except
KeyError
:
return
[]
return
[]
...
...
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