Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1398:b3e1e9ab0500
fixed cookie path to use TRACKER_WEB [SF#667020]
(thanks Luke Opperman for confirming fix)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 24 Jan 2003 06:21:17 +0000 |
| parents | 71928bf79302 |
| children | 27586da5557c |
comparison
equal
deleted
inserted
replaced
| 1397:2219893cb787 | 1398:b3e1e9ab0500 |
|---|---|
| 1 # $Id: client.py,v 1.72 2003-01-20 23:05:19 richard Exp $ | 1 # $Id: client.py,v 1.73 2003-01-24 06:21:17 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 |
| 87 self.env = env | 87 self.env = env |
| 88 | 88 |
| 89 # save off the path | 89 # save off the path |
| 90 self.path = env['PATH_INFO'] | 90 self.path = env['PATH_INFO'] |
| 91 | 91 |
| 92 # this is the base URL for this instance | 92 # this is the base URL for this tracker |
| 93 self.base = self.instance.config.TRACKER_WEB | 93 self.base = self.instance.config.TRACKER_WEB |
| 94 | |
| 95 # this is the "cookie path" for this tracker (ie. the path part of | |
| 96 # the "base" url) | |
| 97 self.cookie_path = urlparse.urlparse(self.base)[2] | |
| 94 | 98 |
| 95 # see if we need to re-parse the environment for the form (eg Zope) | 99 # see if we need to re-parse the environment for the form (eg Zope) |
| 96 if form is None: | 100 if form is None: |
| 97 self.form = cgi.FieldStorage(environ=env) | 101 self.form = cgi.FieldStorage(environ=env) |
| 98 else: | 102 else: |
| 478 | 482 |
| 479 # expire us in a long, long time | 483 # expire us in a long, long time |
| 480 expire = Cookie._getdate(86400*365) | 484 expire = Cookie._getdate(86400*365) |
| 481 | 485 |
| 482 # generate the cookie path - make sure it has a trailing '/' | 486 # generate the cookie path - make sure it has a trailing '/' |
| 483 path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'], | |
| 484 '')) | |
| 485 self.additional_headers['Set-Cookie'] = \ | 487 self.additional_headers['Set-Cookie'] = \ |
| 486 'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, path) | 488 'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, |
| 489 self.cookie_path) | |
| 487 | 490 |
| 488 def make_user_anonymous(self): | 491 def make_user_anonymous(self): |
| 489 ''' Make us anonymous | 492 ''' Make us anonymous |
| 490 | 493 |
| 491 This method used to handle non-existence of the 'anonymous' | 494 This method used to handle non-existence of the 'anonymous' |
| 576 # log us out | 579 # log us out |
| 577 self.make_user_anonymous() | 580 self.make_user_anonymous() |
| 578 | 581 |
| 579 # construct the logout cookie | 582 # construct the logout cookie |
| 580 now = Cookie._getdate() | 583 now = Cookie._getdate() |
| 581 path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'], | |
| 582 '')) | |
| 583 self.additional_headers['Set-Cookie'] = \ | 584 self.additional_headers['Set-Cookie'] = \ |
| 584 'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path) | 585 'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, |
| 586 self.cookie_path) | |
| 585 | 587 |
| 586 # Let the user know what's going on | 588 # Let the user know what's going on |
| 587 self.ok_message.append(_('You are logged out')) | 589 self.ok_message.append(_('You are logged out')) |
| 588 | 590 |
| 589 def registerAction(self): | 591 def registerAction(self): |
