summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad84b40)
raw | patch | inline | side by side (parent: ad84b40)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 1 Sep 2002 22:09:20 +0000 (22:09 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 1 Sep 2002 22:09:20 +0000 (22:09 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1021 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi/client.py | patch | blob | history | |
roundup/cgi/templating.py | patch | blob | history | |
roundup/templates/classic/html/page | patch | blob | history |
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 3c2a87e062a15f94453dc5893601f8f796e26b15..6924ad73d5e69bbe08b4463da3094b8564970915 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $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).
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):
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:
index 93051a0605226f7b29f59b178ccb236933c70703..54a592b6341fa30cc21d1eeffc55e4c801edaa48 100644 (file)
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
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
d['env'] = e
return '''
form: %(form)s
+url: %(url)r
base: %(base)r
classname: %(classname)r
template_type: %(template_type)r
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())))
# 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
index 5194258473e212bd71e905a4d9c43f1b7e26b4b5..f9aec13dc9b1b9e3d1b55bdab51818045392919f 100644 (file)
<tal:block tal:condition="python:request.user.username != 'anonymous'">
<a tal:attributes="href string:issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,title,creator,priority&status=-1,1,2,3,4,5,6,7&assignedto=${request/user/id}">My Issues</a><br>
<a tal:attributes="href string:user${request/user/id}">My Details</a><br>
- <a href="?:action=logout">Logout</a>
+ <a tal:attributes="href python:request.indexargs_href(request.url,
+ {':action':'logout'})">Logout</a>
</tal:block>
</p>
</td>