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
d94b202e
Commit
d94b202e
authored
Jun 03, 2007
by
Andreas Zeidler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrated theuni's additional test from 2.11 (see r73132)
parent
7df72923
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
doc/CHANGES.txt
doc/CHANGES.txt
+4
-0
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+7
-3
lib/python/ZPublisher/tests/testHTTPRequest.py
lib/python/ZPublisher/tests/testHTTPRequest.py
+20
-0
No files found.
doc/CHANGES.txt
View file @
d94b202e
...
...
@@ -4,6 +4,10 @@ Zope Changes
Change information for previous versions of Zope can be found in the
file HISTORY.txt.
Blob-support branch
- Backported feature from Zope 2.11 to support named temporary files.
Zope 2.10.4 (unreleased)
Bugs fixed
...
...
lib/python/ZPublisher/HTTPRequest.py
View file @
d94b202e
...
...
@@ -13,7 +13,7 @@
__version__
=
'$Revision: 1.96 $'
[
11
:
-
2
]
import
re
,
sys
,
os
,
time
,
random
,
codecs
,
inspect
import
re
,
sys
,
os
,
time
,
random
,
codecs
,
inspect
,
tempfile
from
types
import
StringType
,
UnicodeType
from
BaseRequest
import
BaseRequest
,
quote
from
HTTPResponse
import
HTTPResponse
...
...
@@ -394,7 +394,7 @@ class HTTPRequest(BaseRequest):
taintedform
=
self
.
taintedform
meth
=
None
fs
=
FieldStorage
(
fp
=
fp
,
environ
=
environ
,
keep_blank_values
=
1
)
fs
=
Zope
FieldStorage
(
fp
=
fp
,
environ
=
environ
,
keep_blank_values
=
1
)
if
not
hasattr
(
fs
,
'list'
)
or
fs
.
list
is
None
:
# Hm, maybe it's an XML-RPC
if
(
fs
.
headers
.
has_key
(
'content-type'
)
and
...
...
@@ -1417,6 +1417,10 @@ def sane_environment(env):
except
:
pass
return
dict
class
ZopeFieldStorage
(
FieldStorage
):
def
make_file
(
self
,
binary
=
None
):
return
tempfile
.
NamedTemporaryFile
(
"w+b"
)
class
FileUpload
:
'''
\
...
...
@@ -1442,7 +1446,7 @@ class FileUpload:
else
:
methods
=
[
'close'
,
'fileno'
,
'flush'
,
'isatty'
,
'read'
,
'readline'
,
'readlines'
,
'seek'
,
'tell'
,
'truncate'
,
'write'
,
'writelines'
,
'__iter__'
,
'next'
]
# see Collector 1837
'__iter__'
,
'next'
,
'name'
]
# see Collector 1837
d
=
self
.
__dict__
for
m
in
methods
:
...
...
lib/python/ZPublisher/tests/testHTTPRequest.py
View file @
d94b202e
import
unittest
from
urllib
import
quote_plus
TEST_LARGEFILE_DATA
=
'''
--12345
Content-Disposition: form-data; name="file"; filename="file"
Content-Type: application/octet-stream
test %s
'''
%
(
'test'
*
1000
)
class
AuthCredentialsTestsa
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -684,6 +693,17 @@ class RequestTests( unittest.TestCase ):
req
.
close
()
self
.
assertEqual
(
start_count
,
sys
.
getrefcount
(
s
))
# The test
def
testFileName
(
self
):
# checks fileupload object supports the filename
from
StringIO
import
StringIO
s
=
StringIO
(
TEST_LARGEFILE_DATA
)
env
=
TEST_ENVIRON
.
copy
()
from
ZPublisher.HTTPRequest
import
HTTPRequest
req
=
HTTPRequest
(
s
,
env
,
None
)
req
.
processInputs
()
f
=
req
.
form
.
get
(
'file'
)
self
.
assert_
(
f
.
name
)
def
testFileIterator
(
self
):
# checks fileupload object supports the iterator protocol
# collector entry 1837
...
...
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