summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/zope/security/checker.py5
-rw-r--r--src/zope/security/tests/test_checker.py17
2 files changed, 15 insertions, 7 deletions
diff --git a/src/zope/security/checker.py b/src/zope/security/checker.py
index 9687f19..0495fbe 100644
--- a/src/zope/security/checker.py
+++ b/src/zope/security/checker.py
@@ -604,7 +604,7 @@ _typeChecker = NamesChecker(
'__implemented__'])
_namedChecker = NamesChecker(['__name__'])
-_iteratorChecker = NamesChecker(['next', '__iter__', '__len__'])
+_iteratorChecker = NamesChecker(['next', '__next__', '__iter__', '__len__'])
_setChecker = NamesChecker(['__iter__', '__len__', '__str__', '__contains__',
'copy', 'difference', 'intersection', 'issubset',
@@ -651,7 +651,7 @@ _basic_types = {
datetime.time: NoProxy,
datetime.tzinfo: NoProxy,
}
-if PYTHON2:
+if PYTHON2:
_basic_types[long] = NoProxy
_basic_types[unicode] = NoProxy
else: #pragma NO COVER
@@ -783,4 +783,3 @@ except ImportError: #pragma NO COVER
pass
else:
addCleanUp(_clear)
-
diff --git a/src/zope/security/tests/test_checker.py b/src/zope/security/tests/test_checker.py
index 0eabfb6..c5c01e7 100644
--- a/src/zope/security/tests/test_checker.py
+++ b/src/zope/security/tests/test_checker.py
@@ -620,7 +620,7 @@ class Test_MultiChecker(unittest.TestCase):
class IFoo(Interface):
bar = Attribute('Bar')
other_perm = object()
- checker = self._callFUT([(IFoo, other_perm),
+ checker = self._callFUT([(IFoo, other_perm),
(('foo', 'baz'), CheckerPublic)])
self.assertTrue(checker.permission_id('foo') is CheckerPublic)
self.assertTrue(checker.permission_id('bar') is other_perm)
@@ -636,7 +636,7 @@ class Test_MultiChecker(unittest.TestCase):
bar = Attribute('Bar')
other_perm = object()
self.assertRaises(DuplicationError,
- self._callFUT, [(IFoo, other_perm),
+ self._callFUT, [(IFoo, other_perm),
(('foo', 'bar'), CheckerPublic)])
def test_w_spec_as_mapping(self):
@@ -784,7 +784,7 @@ class Test_getCheckerForInstancesOf(unittest.TestCase):
from zope.security.checker import _checkers
class Foo(object):
pass
- checker = _checkers[Foo] = object()
+ checker = _checkers[Foo] = object()
self.assertTrue(self._callFUT(Foo) is checker)
@@ -1362,7 +1362,7 @@ class BasicTypesTests(unittest.TestCase):
BasicTypes.update({Foo: checker})
self.assertTrue(BasicTypes[Foo] is checker)
self.assertTrue(_checkers[Foo] is checker)
-
+
# Pre-geddon tests start here
@@ -1601,6 +1601,15 @@ class Test(unittest.TestCase):
# proxy2 = checker.proxy(proxy)
# self.assertTrue(proxy2 is proxy, [proxy, proxy2])
+ def test_iteration(self):
+ from zope.security.checker import ProxyFactory
+ from zope.security.checker import selectChecker
+
+ for i in ((1,), [1]):
+ _iter = iter(i)
+ proxy = ProxyFactory(_iter, selectChecker(_iter))
+ self.assertEqual(next(proxy), 1)
+
def testLayeredProxies(self):
#Test that a Proxy will not be re-proxied.
from zope.security.proxy import Proxy, getObject