From: richard Date: Sun, 1 Sep 2002 22:09:20 +0000 (+0000) Subject: logout works better now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6b0427b818d6a932e640ee96fa7ceb53eacd15b8;p=roundup.git logout works better now git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1021 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index 3c2a87e..6924ad7 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.3 2002-09-01 12:18:40 richard Exp $ +# $Id: client.py,v 1.4 2002-09-01 22:09:20 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -60,6 +60,11 @@ class Client: 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: + "url" is the current url path + "path" is the PATH_INFO inside the instance + "base" is the base URL for the instance ''' def __init__(self, instance, request, env, form=None): @@ -67,16 +72,21 @@ class Client: self.instance = instance self.request = request self.env = env + self.path = env['PATH_INFO'] self.split_path = self.path.split('/') self.instance_path_name = env['INSTANCE_NAME'] + + # this is the base URL for this instance url = self.env['SCRIPT_NAME'] + '/' + self.instance_path_name - machine = self.env['SERVER_NAME'] - port = self.env['SERVER_PORT'] - if port != '80': machine = machine + ':' + port self.base = urlparse.urlunparse(('http', env['HTTP_HOST'], url, None, None, None)) + # request.path is the full request path + x, x, path, x, x, x = urlparse.urlparse(request.path) + self.url = urlparse.urlunparse(('http', env['HTTP_HOST'], path, + None, None, None)) + if form is None: self.form = cgi.FieldStorage(environ=env) else: diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 93051a0..54a592b 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -851,11 +851,25 @@ def handleListCGIValue(value): else: return value.value.split(',') -# XXX This is starting to look a lot (in data terms) like the client object -# itself! class HTMLRequest: ''' The *request*, holding the CGI form and environment. + "form" the CGI form as a cgi.FieldStorage + "env" the CGI environment variables + "url" the current URL path for this request + "base" the base URL for this instance + "user" a HTMLUser instance for this user + "classname" the current classname (possibly None) + "template_type" the current template type (suffix, also possibly None) + + Index args: + "columns" dictionary of the columns to display in an index page + "sort" index sort column (direction, column name) + "group" index grouping property (direction, column name) + "filter" properties to filter the index on + "filterspec" values to filter the index on + "search_text" text to perform a full-text search on for an index + ''' def __init__(self, client): self.client = client @@ -864,6 +878,7 @@ class HTMLRequest: self.form = client.form self.env = client.env self.base = client.base + self.url = client.url self.user = HTMLUser(client) # store the current class name and action @@ -933,6 +948,7 @@ class HTMLRequest: d['env'] = e return ''' form: %(form)s +url: %(url)r base: %(base)r classname: %(classname)r template_type: %(template_type)r @@ -971,6 +987,7 @@ env: %(env)s return '\n'.join(l) def indexargs_href(self, url, args): + ''' embed the current index args in a URL ''' l = ['%s=%s'%(k,v) for k,v in args.items()] if self.columns: l.append(':columns=%s'%(','.join(self.columns.keys()))) @@ -1040,6 +1057,9 @@ function help_window(helpurl, width, height) { # return the batch object return Batch(self.client, self.classname, l, size, start) + +# extend the standard ZTUtils Batch object to remove dependency on +# Acquisition and add a couple of useful methods class Batch(ZTUtils.Batch): def __init__(self, client, classname, l, size, start, end=0, orphan=0, overlap=0): self.client = client diff --git a/roundup/templates/classic/html/page b/roundup/templates/classic/html/page index 5194258..f9aec13 100644 --- a/roundup/templates/classic/html/page +++ b/roundup/templates/classic/html/page @@ -51,7 +51,8 @@ My Issues
My Details
- Logout + Logout