Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
nexedi
ZODB
Commits
a4a3c368
Commit
a4a3c368
authored
Aug 24, 2009
by
Patrick Strawderman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PersistentList's sort method accept keyword parameters.
parent
8eb1d702
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
src/CHANGES.txt
src/CHANGES.txt
+4
-0
src/persistent/list.py
src/persistent/list.py
+2
-2
src/persistent/tests/test_list.py
src/persistent/tests/test_list.py
+18
-0
No files found.
src/CHANGES.txt
View file @
a4a3c368
...
...
@@ -25,6 +25,10 @@ Bugs Fixed
- Opening a blob with modes 'r+' or 'a' would fail when the blob had no
committed changes.
- PersistentList's sort method did not allow passing of keyword parameters.
Changed its sort parameter list to match that of its (Python 2.4+)
UserList base class.
3.9.0b5 (2009-08-06)
====================
...
...
src/persistent/list.py
View file @
a4a3c368
...
...
@@ -81,8 +81,8 @@ class PersistentList(UserList, persistent.Persistent):
self
.
__super_reverse
()
self
.
_p_changed
=
1
def
sort
(
self
,
*
args
):
self
.
__super_sort
(
*
args
)
def
sort
(
self
,
*
args
,
**
kwargs
):
self
.
__super_sort
(
*
args
,
**
kwargs
)
self
.
_p_changed
=
1
def
extend
(
self
,
other
):
...
...
src/persistent/tests/test_list.py
View file @
a4a3c368
...
...
@@ -217,6 +217,24 @@ class TestPList(unittest.TestCase):
u
.
sort
()
eq
(
u
,
u2
,
"u == u2"
)
# Test keyword arguments to sort
u
.
sort
(
cmp
=
lambda
x
,
y
:
cmp
(
y
,
x
))
eq
(
u
,
[
1
,
0
],
"u == [1, 0]"
)
u
.
sort
(
key
=
lambda
x
:
-
x
)
eq
(
u
,
[
1
,
0
],
"u == [1, 0]"
)
u
.
sort
(
reverse
=
True
)
eq
(
u
,
[
1
,
0
],
"u == [1, 0]"
)
# Passing any other keyword arguments results in a TypeError
try
:
u
.
sort
(
blah
=
True
)
except
TypeError
:
pass
else
:
raise
TestFailed
(
"expected TypeError"
)
# Test extend
u
=
u1
[:]
...
...
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