1.1 --- a/README.txt Tue Nov 18 20:28:58 2008 +0100
1.2 +++ b/README.txt Thu Nov 20 21:31:23 2008 +0100
1.3 @@ -77,6 +77,8 @@
1.4 * Added AuthInfoSelector for the retrieval of authentication details and
1.5 ConditionalAuthSelector for conditional authentication to
1.6 WebStack.Resources.Selectors.
1.7 + * Added a filename attribute to FileContent instances, provided for file
1.8 + upload parameters.
1.9
1.10 New in WebStack 1.2.7 (Changes since WebStack 1.2.6)
1.11 ----------------------------------------------------
2.1 --- a/WebStack/Helpers/Request.py Tue Nov 18 20:28:58 2008 +0100
2.2 +++ b/WebStack/Helpers/Request.py Thu Nov 20 21:31:23 2008 +0100
2.3 @@ -225,11 +225,13 @@
2.4
2.5 Instances of this class contain the following attributes:
2.6
2.7 - * stream - a stream object through which the content of an uploaded file
2.8 - may be accessed
2.9 - * content - a plain string containing the contents of the uploaded file
2.10 - * headers - a dictionary containing the headers associated with the
2.11 - uploaded file
2.12 + * stream - a stream object through which the content of an uploaded file
2.13 + may be accessed
2.14 + * content - a plain string containing the contents of the uploaded file
2.15 + * filename - a plain string containing the supplied filename of the
2.16 + uploaded file
2.17 + * headers - a dictionary containing the headers associated with the
2.18 + uploaded file
2.19 """
2.20
2.21 def __init__(self, stream, headers=None):
2.22 @@ -246,20 +248,30 @@
2.23 def __getattr__(self, name):
2.24
2.25 """
2.26 - Provides a property value when 'name' is specified as "content".
2.27 + Provides a property value when 'name' is specified as "content" or as
2.28 + "filename".
2.29 """
2.30
2.31 - if name != "content":
2.32 - raise AttributeError, name
2.33 + if name == "content":
2.34
2.35 - if self.cache is not None:
2.36 - return self.cache
2.37 + if self.cache is not None:
2.38 + return self.cache
2.39
2.40 - if self.reset():
2.41 - return self.stream.read()
2.42 + if self.reset():
2.43 + return self.stream.read()
2.44 + else:
2.45 + self.cache = self.stream.read()
2.46 + return self.cache
2.47 +
2.48 + elif name == "filename":
2.49 + try:
2.50 + content_disposition = self.headers["Content-Disposition"]
2.51 + return content_disposition.filename
2.52 + except (KeyError, AttributeError):
2.53 + return None
2.54 +
2.55 else:
2.56 - self.cache = self.stream.read()
2.57 - return self.cache
2.58 + raise AttributeError, name
2.59
2.60 def reset(self):
2.61
3.1 --- a/examples/Common/Form/__init__.py Tue Nov 18 20:28:58 2008 +0100
3.2 +++ b/examples/Common/Form/__init__.py Thu Nov 20 21:31:23 2008 +0100
3.3 @@ -137,7 +137,8 @@
3.4
3.5 if type(value) not in (type(""), type(u"")):
3.6 value.reset()
3.7 - details = "%s of length %s: %s" % (
3.8 + details = "file %s of type %s with length %s: %s" % (
3.9 + value.filename,
3.10 value.headers.get("content-type") or "No content type",
3.11 value.headers.get("content-length") or "Unknown",
3.12 repr(value.stream.read(20))
4.1 --- a/packages/ubuntu-feisty/jython-webstack/debian/changelog Tue Nov 18 20:28:58 2008 +0100
4.2 +++ b/packages/ubuntu-feisty/jython-webstack/debian/changelog Thu Nov 20 21:31:23 2008 +0100
4.3 @@ -29,6 +29,8 @@
4.4 authentication details and ConditionalAuthSelector for
4.5 conditional authentication to
4.6 WebStack.Resources.Selectors.
4.7 + * Added a filename attribute to FileContent instances,
4.8 + provided for file upload parameters.
4.9
4.10 -- Paul Boddie <paul@boddie.org.uk> Sat, 15 Nov 2008 02:27:03 +0100
4.11
5.1 --- a/packages/ubuntu-feisty/python-webstack/debian/changelog Tue Nov 18 20:28:58 2008 +0100
5.2 +++ b/packages/ubuntu-feisty/python-webstack/debian/changelog Thu Nov 20 21:31:23 2008 +0100
5.3 @@ -29,6 +29,8 @@
5.4 authentication details and ConditionalAuthSelector for
5.5 conditional authentication to
5.6 WebStack.Resources.Selectors.
5.7 + * Added a filename attribute to FileContent instances,
5.8 + provided for file upload parameters.
5.9
5.10 -- Paul Boddie <paul@boddie.org.uk> Sat, 15 Nov 2008 02:26:43 +0100
5.11
6.1 --- a/packages/ubuntu-gutsy/jython-webstack/debian/changelog Tue Nov 18 20:28:58 2008 +0100
6.2 +++ b/packages/ubuntu-gutsy/jython-webstack/debian/changelog Thu Nov 20 21:31:23 2008 +0100
6.3 @@ -29,6 +29,8 @@
6.4 authentication details and ConditionalAuthSelector for
6.5 conditional authentication to
6.6 WebStack.Resources.Selectors.
6.7 + * Added a filename attribute to FileContent instances,
6.8 + provided for file upload parameters.
6.9
6.10 -- Paul Boddie <paul@boddie.org.uk> Sat, 15 Nov 2008 02:27:03 +0100
6.11
7.1 --- a/packages/ubuntu-gutsy/python-webstack/debian/changelog Tue Nov 18 20:28:58 2008 +0100
7.2 +++ b/packages/ubuntu-gutsy/python-webstack/debian/changelog Thu Nov 20 21:31:23 2008 +0100
7.3 @@ -29,6 +29,8 @@
7.4 authentication details and ConditionalAuthSelector for
7.5 conditional authentication to
7.6 WebStack.Resources.Selectors.
7.7 + * Added a filename attribute to FileContent instances,
7.8 + provided for file upload parameters.
7.9
7.10 -- Paul Boddie <paul@boddie.org.uk> Sat, 15 Nov 2008 02:26:43 +0100
7.11
8.1 --- a/packages/ubuntu-hoary/python2.4-webstack/debian/changelog Tue Nov 18 20:28:58 2008 +0100
8.2 +++ b/packages/ubuntu-hoary/python2.4-webstack/debian/changelog Thu Nov 20 21:31:23 2008 +0100
8.3 @@ -29,6 +29,8 @@
8.4 authentication details and ConditionalAuthSelector for
8.5 conditional authentication to
8.6 WebStack.Resources.Selectors.
8.7 + * Added a filename attribute to FileContent instances,
8.8 + provided for file upload parameters.
8.9
8.10 -- Paul Boddie <paul@boddie.org.uk> Sat, 15 Nov 2008 02:24:13 +0100
8.11