1.1 --- a/WebStack/Django.py Tue Oct 23 23:26:37 2007 +0000
1.2 +++ b/WebStack/Django.py Tue Oct 23 23:27:17 2007 +0000
1.3 @@ -265,7 +265,11 @@
1.4 def _get_files(self):
1.5 files = {}
1.6 for name, file in self.request.FILES.items():
1.7 - files[name] = [FileContent(file.get("content", ""), {
1.8 +
1.9 + # NOTE: Django does not seem to expose a stream for a file upload.
1.10 +
1.11 + files[name] = [FileContent(
1.12 + StringIO(file.get("content", "")), {
1.13 "Content-Type" : file.get("content-type", ""),
1.14 "Content-Disposition" : "%s; filename=%s" % (name, file.get("filename", ""))
1.15 })]
2.1 --- a/WebStack/JavaServlet.py Tue Oct 23 23:26:37 2007 +0000
2.2 +++ b/WebStack/JavaServlet.py Tue Oct 23 23:27:17 2007 +0000
2.3 @@ -626,11 +626,11 @@
2.4 # Convert input stream content.
2.5
2.6 if isinstance(subcontent, java.io.InputStream):
2.7 - subcontent = Stream(subcontent).read()
2.8 + subcontent = Stream(subcontent)
2.9
2.10 # Record string content.
2.11
2.12 - if type(subcontent) == type(""):
2.13 + if isinstance(subcontent, (type(""), Stream)):
2.14
2.15 # Should get: form-data; name="x"
2.16
3.1 --- a/WebStack/ModPython.py Tue Oct 23 23:26:37 2007 +0000
3.2 +++ b/WebStack/ModPython.py Tue Oct 23 23:27:17 2007 +0000
3.3 @@ -297,7 +297,7 @@
3.4 # Detect and store file uploads.
3.5
3.6 if field.filename:
3.7 - fields[field_name].append(FileContent(field.value, parse_headers(field.headers)))
3.8 + fields[field_name].append(FileContent(field.file, parse_headers(field.headers)))
3.9 else:
3.10 fields[field_name].append(get_body_field(field.value, encoding))
3.11
4.1 --- a/WebStack/__init__.py Tue Oct 23 23:26:37 2007 +0000
4.2 +++ b/WebStack/__init__.py Tue Oct 23 23:27:17 2007 +0000
4.3 @@ -20,6 +20,6 @@
4.4 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
4.5 """
4.6
4.7 -__version__ = "1.2.6"
4.8 +__version__ = "1.2.7"
4.9
4.10 # vim: tabstop=4 expandtab shiftwidth=4