Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
5ae156cf
Commit
5ae156cf
authored
Jul 21, 2005
by
Tino Wildenhain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FileUpload object to support iterator protocol - see collector entry #1837
parent
7e38f374
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+3
-2
lib/python/ZPublisher/tests/testHTTPRequest.py
lib/python/ZPublisher/tests/testHTTPRequest.py
+11
-0
No files found.
lib/python/ZPublisher/HTTPRequest.py
View file @
5ae156cf
...
@@ -1422,7 +1422,8 @@ class FileUpload:
...
@@ -1422,7 +1422,8 @@ class FileUpload:
if
hasattr
(
file
,
'__methods__'
):
methods
=
file
.
__methods__
if
hasattr
(
file
,
'__methods__'
):
methods
=
file
.
__methods__
else
:
methods
=
[
'close'
,
'fileno'
,
'flush'
,
'isatty'
,
else
:
methods
=
[
'close'
,
'fileno'
,
'flush'
,
'isatty'
,
'read'
,
'readline'
,
'readlines'
,
'seek'
,
'read'
,
'readline'
,
'readlines'
,
'seek'
,
'tell'
,
'truncate'
,
'write'
,
'writelines'
]
'tell'
,
'truncate'
,
'write'
,
'writelines'
,
'__iter__'
]
# see Collector 1837
d
=
self
.
__dict__
d
=
self
.
__dict__
for
m
in
methods
:
for
m
in
methods
:
...
@@ -1566,4 +1567,4 @@ def _filterPasswordFields(items):
...
@@ -1566,4 +1567,4 @@ def _filterPasswordFields(items):
# if any trusted-proxies are defined in the configuration file.
# if any trusted-proxies are defined in the configuration file.
trusted_proxies
=
[]
trusted_proxies
=
[]
lib/python/ZPublisher/tests/testHTTPRequest.py
View file @
5ae156cf
...
@@ -619,6 +619,17 @@ class RequestTests( unittest.TestCase ):
...
@@ -619,6 +619,17 @@ class RequestTests( unittest.TestCase ):
req
.
close
()
req
.
close
()
self
.
assertEqual
(
start_count
,
sys
.
getrefcount
(
s
))
# The test
self
.
assertEqual
(
start_count
,
sys
.
getrefcount
(
s
))
# The test
def
testFileIteator
(
self
):
# checks fileupload object supports the iterator protocol
# collector entry 1837
import
sys
from
StringIO
import
StringIO
s
=
StringIO
(
TEST_FILE_DATA
)
env
=
TEST_ENVIRON
.
copy
()
from
ZPublisher.HTTPRequest
import
HTTPRequest
req
=
HTTPRequest
(
s
,
env
,
None
)
req
.
processInputs
()
self
.
assertEqual
(
list
(
req
.
form
.
get
(
'file'
)),[
'test
\
n
'
])
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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