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
8962125f
Commit
8962125f
authored
Apr 20, 2008
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- synced formatting of FileUpload class with zope.publisher.browser.FileUpload
parent
9b67c91c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+26
-17
No files found.
lib/python/ZPublisher/HTTPRequest.py
View file @
8962125f
...
...
@@ -7,11 +7,13 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
""" HTTP request management.
__version__
=
'$Revision: 1.96 $'
[
11
:
-
2
]
$Id$
"""
import
re
,
sys
,
os
,
time
,
random
,
codecs
,
tempfile
from
types
import
StringType
,
UnicodeType
...
...
@@ -1456,9 +1458,10 @@ class ZopeFieldStorage(FieldStorage):
def
make_file
(
self
,
binary
=
None
):
return
tempfile
.
NamedTemporaryFile
(
"w+b"
)
# Zope 3 version: zope.publisher.browser.FileUpload
class
FileUpload
:
'''
\
File upload objects
'''File upload objects
File upload objects are used to represent file-uploaded data.
...
...
@@ -1471,28 +1474,33 @@ class FileUpload:
# Allow access to attributes such as headers and filename so
# that ZClass authors can use DTML to work with FileUploads.
__allow_access_to_unprotected_subobjects__
=
1
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
aFieldStorage
):
file
=
aFieldStorage
.
file
if
hasattr
(
file
,
'__methods__'
):
methods
=
file
.
__methods__
else
:
methods
=
[
'close'
,
'fileno'
,
'flush'
,
'isatty'
,
'read'
,
'readline'
,
'readlines'
,
'seek'
,
'tell'
,
'truncate'
,
'write'
,
'writelines'
,
'__iter__'
,
'next'
,
'name'
]
# see Collector 1837
file
=
aFieldStorage
.
file
if
hasattr
(
file
,
'__methods__'
):
methods
=
file
.
__methods__
else
:
methods
=
[
'close'
,
'fileno'
,
'flush'
,
'isatty'
,
'read'
,
'readline'
,
'readlines'
,
'seek'
,
'tell'
,
'truncate'
,
'write'
,
'writelines'
,
'__iter__'
,
'next'
,
'name'
]
# see Collector 1837
d
=
self
.
__dict__
d
=
self
.
__dict__
for
m
in
methods
:
if
hasattr
(
file
,
m
):
d
[
m
]
=
getattr
(
file
,
m
)
if
hasattr
(
file
,
m
):
d
[
m
]
=
getattr
(
file
,
m
)
self
.
headers
=
aFieldStorage
.
headers
self
.
filename
=
aFieldStorage
.
filename
self
.
headers
=
aFieldStorage
.
headers
self
.
filename
=
aFieldStorage
.
filename
# Add an assertion to the rfc822.Message object that implements
# self.headers so that managed code can access them.
try
:
self
.
headers
.
__allow_access_to_unprotected_subobjects__
=
1
except
:
pass
try
:
self
.
headers
.
__allow_access_to_unprotected_subobjects__
=
1
except
:
pass
def
__nonzero__
(
self
):
"""FileUpload objects are considered false if their
...
...
@@ -1503,6 +1511,7 @@ class FileUpload:
def
xreadlines
(
self
):
return
self
parse_cookie_lock
=
allocate_lock
()
def
parse_cookie
(
text
,
result
=
None
,
...
...
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