diff roundup/cgi/client.py @ 1400:3c9bd1faddd8 maint-0.5

backporting fixes from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Fri, 24 Jan 2003 06:25:16 +0000
parents a87f59436895
children 3a853f1c20b5
line wrap: on
line diff
--- a/roundup/cgi/client.py	Mon Jan 20 23:00:56 2003 +0000
+++ b/roundup/cgi/client.py	Fri Jan 24 06:25:16 2003 +0000
@@ -1,4 +1,4 @@
-# $Id: client.py,v 1.65.2.1 2003-01-15 22:38:14 richard Exp $
+# $Id: client.py,v 1.65.2.2 2003-01-24 06:25:16 richard Exp $
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
@@ -92,6 +92,10 @@
         # this is the base URL for this instance
         self.base = self.instance.config.TRACKER_WEB
 
+        # this is the "cookie path" for this tracker (ie. the path part of
+        # the "base" url)
+        self.cookie_path = urlparse.urlparse(self.base)[2]
+
         # see if we need to re-parse the environment for the form (eg Zope)
         if form is None:
             self.form = cgi.FieldStorage(environ=env)
@@ -470,10 +474,9 @@
         expire = Cookie._getdate(86400*365)
 
         # generate the cookie path - make sure it has a trailing '/'
-        path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
-            ''))
         self.additional_headers['Set-Cookie'] = \
-          'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, path)
+          'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire,
+            self.cookie_path)
 
     def make_user_anonymous(self):
         ''' Make us anonymous
@@ -568,10 +571,9 @@
 
         # construct the logout cookie
         now = Cookie._getdate()
-        path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
-            ''))
         self.additional_headers['Set-Cookie'] = \
-           'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)
+           'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now,
+            self.cookie_path)
 
         # Let the user know what's going on
         self.ok_message.append(_('You are logged out'))

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