1.1 --- a/WebStack/Twisted.py Wed Feb 25 22:29:56 2004 +0000
1.2 +++ b/WebStack/Twisted.py Wed Feb 25 22:30:23 2004 +0000
1.3 @@ -91,9 +91,7 @@
1.4 A framework-specific method which gets the entire path from the request.
1.5 """
1.6
1.7 - # NOTE: The path and "path info" are mostly equivalent for Twisted.
1.8 -
1.9 - return self.get_path_info()
1.10 + return self.trans.uri
1.11
1.12 def get_path_info(self):
1.13
1.14 @@ -105,18 +103,64 @@
1.15
1.16 return "/%s" % "/".join(self.trans.postpath)
1.17
1.18 + def get_query_string(self):
1.19 +
1.20 + """
1.21 + A framework-specific method which gets the query string from the path in
1.22 + the request.
1.23 + """
1.24 +
1.25 + t = self.get_path().split("?")
1.26 + if len(t) == 1:
1.27 + return ""
1.28 + else:
1.29 +
1.30 + # NOTE: Overlook erroneous usage of "?" characters in the path.
1.31 +
1.32 + return "?".join(t[1:])
1.33 +
1.34 # Higher level request-related methods.
1.35
1.36 + def get_fields_from_path(self):
1.37 +
1.38 + """
1.39 + A framework-specific method which extracts the form fields from the
1.40 + path specified in the transaction. The underlying framework may refuse
1.41 + to supply fields from the path if handling a POST transaction.
1.42 +
1.43 + The returned object should employ the cgi.FieldStorage interface.
1.44 + """
1.45 +
1.46 + # NOTE: May need a wrapper around this object.
1.47 +
1.48 + return self.trans.args
1.49 +
1.50 + def get_fields_from_body(self):
1.51 +
1.52 + """
1.53 + A framework-specific method which extracts the form fields from the
1.54 + message body in the transaction.
1.55 +
1.56 + The returned object should employ the cgi.FieldStorage interface.
1.57 + """
1.58 +
1.59 + # NOTE: May need a wrapper around this object.
1.60 +
1.61 + return self.trans.args
1.62 +
1.63 def get_fields(self):
1.64
1.65 """
1.66 A framework-specific method which extracts the form fields from the
1.67 - transaction.
1.68 + transaction. Typically, the origin of the form fields will be affected
1.69 + by the method specified in the transaction.
1.70 +
1.71 + The returned object should employ the cgi.FieldStorage interface.
1.72 """
1.73
1.74 - # NOTE: Discard multiple field values.
1.75 + # NOTE: May need a wrapper around this object.
1.76
1.77 - return dict([(key, value[0]) for (key, value) in self.trans.args.items()])
1.78 + return self.trans.args
1.79
1.80 def get_user(self):
1.81