Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope.proxy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
zope.proxy
Commits
0da36eda
Commit
0da36eda
authored
Jun 06, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back out support for __reversed__.
Python 2.7 adds B&D checks which break for the C wrapper.
parent
737e25e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
src/zope/proxy/__init__.py
src/zope/proxy/__init__.py
+3
-2
src/zope/proxy/tests/test_proxy.py
src/zope/proxy/tests/test_proxy.py
+7
-3
No files found.
src/zope/proxy/__init__.py
View file @
0da36eda
...
@@ -137,8 +137,9 @@ class PyProxyBase(object):
...
@@ -137,8 +137,9 @@ class PyProxyBase(object):
# Called when we wrap an iterator itself.
# Called when we wrap an iterator itself.
return
self
.
_wrapped
.
next
()
return
self
.
_wrapped
.
next
()
def
__reversed__
(
self
):
# Python 2.7 won't let the C wrapper support __reversed__ :(
return
reversed
(
self
.
_wrapped
)
#def __reversed__(self):
# return reversed(self._wrapped)
def
__contains__
(
self
,
item
):
def
__contains__
(
self
,
item
):
return
item
in
self
.
_wrapped
return
item
in
self
.
_wrapped
...
...
src/zope/proxy/tests/test_proxy.py
View file @
0da36eda
...
@@ -341,9 +341,10 @@ class PyProxyBaseTestCase(unittest.TestCase):
...
@@ -341,9 +341,10 @@ class PyProxyBaseTestCase(unittest.TestCase):
b
.
append
(
x
)
b
.
append
(
x
)
self
.
assertEqual
(
a
,
b
)
self
.
assertEqual
(
a
,
b
)
def
test___reversed__
(
self
):
# Python 2.7 won't let the C wrapper support __reversed__ :(
w
=
self
.
_makeOne
([
0
,
1
,
2
,
3
])
#def test___reversed__(self):
self
.
assertEqual
(
list
(
reversed
(
w
)),
[
3
,
2
,
1
,
0
])
# w = self._makeOne([0, 1, 2, 3])
# self.assertEqual(list(reversed(w)), [3, 2, 1, 0])
def
test___contains__
(
self
):
def
test___contains__
(
self
):
w
=
self
.
_makeOne
([
0
,
1
,
2
,
3
])
w
=
self
.
_makeOne
([
0
,
1
,
2
,
3
])
...
@@ -1020,6 +1021,9 @@ class Test_nonOverridable(unittest.TestCase):
...
@@ -1020,6 +1021,9 @@ class Test_nonOverridable(unittest.TestCase):
return
'FOO'
return
'FOO'
def
what
(
self
):
def
what
(
self
):
return
'FOO'
return
'FOO'
p0
=
ProxyBase
(
Foo
())
self
.
assertEqual
(
p0
.
who
(),
'FOO'
)
self
.
assertEqual
(
p0
.
what
(),
'FOO'
)
proxy
=
Proxy
(
Foo
())
proxy
=
Proxy
(
Foo
())
self
.
assertEqual
(
proxy
.
who
(),
'FOO'
)
self
.
assertEqual
(
proxy
.
who
(),
'FOO'
)
self
.
assertEqual
(
proxy
.
what
(),
'PROXY'
)
self
.
assertEqual
(
proxy
.
what
(),
'PROXY'
)
...
...
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