Commit b994943d authored by Tres Seaver's avatar Tres Seaver

Collector #2287: form ':record' objects did not implement enough of the mapping interface.

parent 0bb6d12d
...@@ -8,6 +8,9 @@ Zope Changes ...@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed Bugs fixed
- Collector #2287: form ':record' objects did not implement enough of
the mapping interface.
- Collector #2352: fix in OFS.Traversable - Collector #2352: fix in OFS.Traversable
- Collector #2346: username logging in FCGI crashed the server - Collector #2346: username logging in FCGI crashed the server
......
...@@ -1529,7 +1529,7 @@ class record: ...@@ -1529,7 +1529,7 @@ class record:
_guarded_writes = 1 _guarded_writes = 1
def __getattr__(self, key, default=None): def __getattr__(self, key, default=None):
if key in ('get', 'keys', 'items', 'values', 'copy', 'has_key'): if key in ('get', 'keys', 'items', 'values', 'copy', 'has_key', '__contains__', '__iter__', '__len__'):
return getattr(self.__dict__, key) return getattr(self.__dict__, key)
raise AttributeError, key raise AttributeError, key
......
...@@ -77,6 +77,28 @@ class RecordTests( unittest.TestCase ): ...@@ -77,6 +77,28 @@ class RecordTests( unittest.TestCase ):
d = eval( r ) d = eval( r )
self.assertEqual( d, record.__dict__ ) self.assertEqual( d, record.__dict__ )
def test_contains(self):
from ZPublisher.HTTPRequest import record
record = record()
record.a = 1
self.assertTrue('a' in record)
def test_iter(self):
from ZPublisher.HTTPRequest import record
record = record()
record.a = 1
record.b = 2
record.c = 3
for k in record:
self.assertTrue(k in ('a','b','c'))
def test_len(self):
from ZPublisher.HTTPRequest import record
record = record()
record.a = 1
record.b = 2
record.c = 3
self.assertEqual(len(record), 3)
class ProcessInputsTests(unittest.TestCase): class ProcessInputsTests(unittest.TestCase):
def _getHTTPRequest(self, env): def _getHTTPRequest(self, env):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment