1.1 --- a/WebStack/BaseHTTPRequestHandler.py Sat Feb 28 20:55:36 2004 +0000
1.2 +++ b/WebStack/BaseHTTPRequestHandler.py Sun Feb 29 00:04:53 2004 +0000
1.3 @@ -176,11 +176,16 @@
1.4 storage = FieldStorage(fp=self.get_request_stream(), headers=self.get_headers(),
1.5 environ={"REQUEST_METHOD" : self.get_request_method()}, keep_blank_values=1)
1.6
1.7 - # Traverse the storage, finding each field value.
1.8 + # Avoid strange design issues with FieldStorage by checking the internal
1.9 + # field list directly.
1.10
1.11 fields = {}
1.12 - for field_name in storage.keys():
1.13 - fields[field_name] = storage.getlist(field_name)
1.14 + if storage.list is not None:
1.15 +
1.16 + # Traverse the storage, finding each field value.
1.17 +
1.18 + for field_name in storage.keys():
1.19 + fields[field_name] = storage.getlist(field_name)
1.20 return fields
1.21
1.22 def get_user(self):
2.1 --- a/WebStack/Generic.py Sat Feb 28 20:55:36 2004 +0000
2.2 +++ b/WebStack/Generic.py Sun Feb 29 00:04:53 2004 +0000
2.3 @@ -305,4 +305,42 @@
2.4
2.5 raise NotImplementedError, "respond"
2.6
2.7 +class Authenticator:
2.8 +
2.9 + "A generic authentication component."
2.10 +
2.11 + def authenticate(self, trans):
2.12 +
2.13 + """
2.14 + An application-specific method which authenticates the sender of the
2.15 + request described by the transaction object 'trans'. This method should
2.16 + consider 'trans' to be read-only and not attempt to change the state of
2.17 + the transaction.
2.18 +
2.19 + If the sender of the request is authenticated successfully, the result
2.20 + of this method evaluates to true; otherwise the result of this method
2.21 + evaluates to false.
2.22 + """
2.23 +
2.24 + raise NotImplementedError, "authenticate"
2.25 +
2.26 + def get_auth_type(self):
2.27 +
2.28 + """
2.29 + An application-specific method which returns the authentication type to
2.30 + be used. An example value is 'Basic' which specifies HTTP basic
2.31 + authentication.
2.32 + """
2.33 +
2.34 + raise NotImplementedError, "get_auth_type"
2.35 +
2.36 + def get_realm(self):
2.37 +
2.38 + """
2.39 + An application-specific method which returns the name of the realm for
2.40 + which authentication is taking place.
2.41 + """
2.42 +
2.43 + raise NotImplementedError, "get_realm"
2.44 +
2.45 # vim: tabstop=4 expandtab shiftwidth=4