Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 1244:8dd4f736370b
merge from maintenance branch
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 03 Oct 2002 06:56:30 +0000 |
| parents | dd52bf10f934 |
| children | 6c24a86a12ae |
line wrap: on
line diff
--- a/roundup/cgi/client.py Wed Oct 02 19:15:46 2002 +0000 +++ b/roundup/cgi/client.py Thu Oct 03 06:56:30 2002 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.48 2002-09-27 01:04:38 richard Exp $ +# $Id: client.py,v 1.49 2002-10-03 06:56:29 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -48,23 +48,36 @@ security.addPermissionToRole('Admin', p) class Client: - ''' - A note about login - ------------------ + ''' Instantiate to handle one CGI request. - If the user has no login cookie, then they are anonymous. There - are two levels of anonymous use. If there is no 'anonymous' user, there - is no login at all and the database is opened in read-only mode. If the - 'anonymous' user exists, the user is logged in using that user (though - there is no cookie). This allows them to modify the database, and all - modifications are attributed to the 'anonymous' user. + See inner_main for request processing. - Once a user logs in, they are assigned a session. The Client instance - keeps the nodeid of the session as the "session" attribute. - - Client attributes: + Client attributes at instantiation: "path" is the PATH_INFO inside the instance (with no leading '/') "base" is the base URL for the instance + "form" is the cgi form, an instance of FieldStorage from the standard + cgi module + "additional_headers" is a dictionary of additional HTTP headers that + should be sent to the client + "response_code" is the HTTP response code to send to the client + + During the processing of a request, the following attributes are used: + "error_message" holds a list of error messages + "ok_message" holds a list of OK messages + "session" is the current user session id + "user" is the current user's name + "userid" is the current user's id + "template" is the current :template context + "classname" is the current class context name + "nodeid" is the current context item id + + User Identification: + If the user has no login cookie, then they are anonymous and are logged + in as that user. This typically gives them all Permissions assigned to the + Anonymous Role. + + Once a user logs in, they are assigned a session. The Client instance + keeps the nodeid of the session as the "session" attribute. ''' def __init__(self, instance, request, env, form=None): @@ -134,7 +147,6 @@ - NotFound (raised wherever it needs to be) percolates up to the CGI interface that called the client ''' - self.content_action = None self.ok_message = [] self.error_message = [] try: @@ -167,7 +179,10 @@ except SendStaticFile, file: self.serve_static_file(str(file)) except Unauthorised, message: - self.write(self.renderTemplate('page', '', error_message=message)) + self.classname=None + self.template='' + self.error_message.append(message) + self.write(self.renderContext()) except NotFound: # pass through raise
