1.1 --- a/WebStack/Twisted.py Sun Feb 08 18:16:37 2004 +0000
1.2 +++ b/WebStack/Twisted.py Sun Feb 08 21:41:46 2004 +0000
1.3 @@ -5,6 +5,7 @@
1.4 """
1.5
1.6 import Generic
1.7 +from Helpers.Auth import UserInfo
1.8
1.9 class Transaction(Generic.Transaction):
1.10
1.11 @@ -114,9 +115,13 @@
1.12 transaction.
1.13 """
1.14
1.15 - # NOTE: Not implemented yet, but just pretend that there are no users.
1.16 + # NOTE: Twisted makes headers lower case, for some reason.
1.17
1.18 - return None
1.19 + auth_header = self.get_headers().get("authorization")
1.20 + if auth_header:
1.21 + return UserInfo(auth_header).username
1.22 + else:
1.23 + return None
1.24
1.25 # Response-related methods.
1.26
1.27 @@ -149,6 +154,14 @@
1.28
1.29 self.trans.setResponseCode(response_code)
1.30
1.31 + def set_header(self, header, value):
1.32 +
1.33 + """
1.34 + Set the HTTP 'header' with the given 'value'.
1.35 + """
1.36 +
1.37 + self.trans.setHeader(self.format_header_value(header), self.format_header_value(value))
1.38 +
1.39 def set_content_type(self, content_type):
1.40
1.41 """