Commit 0458a733 authored by Tino Wildenhain's avatar Tino Wildenhain

Refinement of collector issue 1837 - add next() and xreadlines() for a full...

Refinement of collector issue 1837 - add next() and xreadlines() for a full file interface to ZPublisher/HTTPRequest.py and appropriate test case + changes.txt entry
parent 5ae156cf
......@@ -34,6 +34,14 @@ Zope Changes
This allows to migrate interfaces to Zope 3 style interfaces and
bridge them back to oldstyle interfaces for backwards compatibility.
- ZConfig extension, address now also accepts symbolic port names
from etc/services (unix) or etc\services (win32)
- ZPublisher.HTTPRequest.FileUpload now supports full file object interface.
This means Iterator support was added. (for line in fileobject: ...,
as well as fileobject.next() and fileobject.xreadlines() )
Collector #1837
after Zope 2.8b1
Features added
......@@ -47,7 +55,7 @@ Zope Changes
- Collector #1844: fixed whitespace handling in the ZMI "Find" tab
- Collector #1815: ZCTextIndex accepts (again) sequences of strings to
- Collector #1815: ZCTextIndex accepts (again) sequences of strings to
be indexed.
- Collector #1812: Fixed key error in ZSQL ZMI/Test
......@@ -71,9 +79,9 @@ Zope Changes
- Collector #1803: Fixed InitializeClass for some corner case.
- Collector #1798, issue1: ZopeTestCase no longer tries to
- Collector #1798, issue1: ZopeTestCase no longer tries to
install products that was installed by Zope during startup.
- Collector #1323: applied patch to fix umask problem in zdctl
- Collector #1781: made 'create_mount_points' ZConfig option actually
......
......@@ -1423,7 +1423,7 @@ class FileUpload:
else: methods= ['close', 'fileno', 'flush', 'isatty',
'read', 'readline', 'readlines', 'seek',
'tell', 'truncate', 'write', 'writelines',
'__iter__'] # see Collector 1837
'__iter__','next'] # see Collector 1837
d=self.__dict__
for m in methods:
......@@ -1443,6 +1443,8 @@ class FileUpload:
"""
return not not self.filename
def xreadlines(self):
return self
parse_cookie_lock=allocate_lock()
def parse_cookie(text,
......
......@@ -619,7 +619,7 @@ class RequestTests( unittest.TestCase ):
req.close()
self.assertEqual(start_count, sys.getrefcount(s)) # The test
def testFileIteator(self):
def testFileIterator(self):
# checks fileupload object supports the iterator protocol
# collector entry 1837
import sys
......@@ -629,7 +629,12 @@ class RequestTests( unittest.TestCase ):
from ZPublisher.HTTPRequest import HTTPRequest
req = HTTPRequest(s, env, None)
req.processInputs()
self.assertEqual(list(req.form.get('file')),['test\n'])
f=req.form.get('file')
self.assertEqual(list(f),['test\n'])
f.seek(0)
self.assertEqual(f.next(),'test\n')
f.seek(0)
self.assertEqual(f.xreadlines(),f)
def test_suite():
suite = unittest.TestSuite()
......
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