1.1 --- a/WebStack/Webware.py Thu May 27 22:18:00 2004 +0000
1.2 +++ b/WebStack/Webware.py Sat May 29 17:25:44 2004 +0000
1.3 @@ -21,6 +21,7 @@
1.4 "Initialise the transaction using the Webware transaction 'trans'."
1.5
1.6 self.trans = trans
1.7 + self.user = None
1.8
1.9 # Request-related methods.
1.10
1.11 @@ -188,6 +189,9 @@
1.12 # NOTE: actual headers are not available. Therefore, the Web server must
1.13 # NOTE: itself be set up to provide user support.
1.14
1.15 + if self.user is not None:
1.16 + return self.user
1.17 +
1.18 try:
1.19 return self.trans.request().remoteUser()
1.20 except KeyError, exc:
1.21 @@ -311,4 +315,16 @@
1.22
1.23 self.trans.response().delCookie(cookie_name)
1.24
1.25 + # Application-specific methods.
1.26 +
1.27 + def set_user(self, username):
1.28 +
1.29 + """
1.30 + An application-specific method which sets the user information with
1.31 + 'username' in the transaction. This affects subsequent calls to
1.32 + 'get_user'.
1.33 + """
1.34 +
1.35 + self.user = username
1.36 +
1.37 # vim: tabstop=4 expandtab shiftwidth=4