comparison roundup/cgi/client.py @ 1004:5f12d3259f31

logout works better now
author Richard Jones <richard@users.sourceforge.net>
date Sun, 01 Sep 2002 22:09:20 +0000
parents f89b8d32291b
children efa19bdad6c3
comparison
equal deleted inserted replaced
1003:f89b8d32291b 1004:5f12d3259f31
1 # $Id: client.py,v 1.3 2002-09-01 12:18:40 richard Exp $ 1 # $Id: client.py,v 1.4 2002-09-01 22:09:20 richard Exp $
2 2
3 __doc__ = """ 3 __doc__ = """
4 WWW request handler (also used in the stand-alone server). 4 WWW request handler (also used in the stand-alone server).
5 """ 5 """
6 6
58 there is no cookie). This allows them to modify the database, and all 58 there is no cookie). This allows them to modify the database, and all
59 modifications are attributed to the 'anonymous' user. 59 modifications are attributed to the 'anonymous' user.
60 60
61 Once a user logs in, they are assigned a session. The Client instance 61 Once a user logs in, they are assigned a session. The Client instance
62 keeps the nodeid of the session as the "session" attribute. 62 keeps the nodeid of the session as the "session" attribute.
63
64 Client attributes:
65 "url" is the current url path
66 "path" is the PATH_INFO inside the instance
67 "base" is the base URL for the instance
63 ''' 68 '''
64 69
65 def __init__(self, instance, request, env, form=None): 70 def __init__(self, instance, request, env, form=None):
66 hyperdb.traceMark() 71 hyperdb.traceMark()
67 self.instance = instance 72 self.instance = instance
68 self.request = request 73 self.request = request
69 self.env = env 74 self.env = env
75
70 self.path = env['PATH_INFO'] 76 self.path = env['PATH_INFO']
71 self.split_path = self.path.split('/') 77 self.split_path = self.path.split('/')
72 self.instance_path_name = env['INSTANCE_NAME'] 78 self.instance_path_name = env['INSTANCE_NAME']
79
80 # this is the base URL for this instance
73 url = self.env['SCRIPT_NAME'] + '/' + self.instance_path_name 81 url = self.env['SCRIPT_NAME'] + '/' + self.instance_path_name
74 machine = self.env['SERVER_NAME']
75 port = self.env['SERVER_PORT']
76 if port != '80': machine = machine + ':' + port
77 self.base = urlparse.urlunparse(('http', env['HTTP_HOST'], url, 82 self.base = urlparse.urlunparse(('http', env['HTTP_HOST'], url,
83 None, None, None))
84
85 # request.path is the full request path
86 x, x, path, x, x, x = urlparse.urlparse(request.path)
87 self.url = urlparse.urlunparse(('http', env['HTTP_HOST'], path,
78 None, None, None)) 88 None, None, None))
79 89
80 if form is None: 90 if form is None:
81 self.form = cgi.FieldStorage(environ=env) 91 self.form = cgi.FieldStorage(environ=env)
82 else: 92 else:

Roundup Issue Tracker: http://roundup-tracker.org/