|
1 | | -# $Id: client.py,v 1.76 2003-02-06 05:43:47 richard Exp $ |
| 1 | +# $Id: client.py,v 1.77 2003-02-07 04:49:13 richard Exp $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -95,6 +95,8 @@ def __init__(self, instance, request, env, form=None): |
95 | 95 | # this is the "cookie path" for this tracker (ie. the path part of |
96 | 96 | # the "base" url) |
97 | 97 | self.cookie_path = urlparse.urlparse(self.base)[2] |
| 98 | + self.cookie_name = 'roundup_session_' + re.sub('[^a-zA-Z]', '', |
| 99 | + self.instance.config.TRACKER_NAME) |
98 | 100 |
|
99 | 101 | # see if we need to re-parse the environment for the form (eg Zope) |
100 | 102 | if form is None: |
@@ -227,11 +229,11 @@ def determine_user(self): |
227 | 229 | user = 'anonymous' |
228 | 230 |
|
229 | 231 | # bump the "revision" of the cookie since the format changed |
230 | | - if (cookie.has_key('roundup_user_2') and |
231 | | - cookie['roundup_user_2'].value != 'deleted'): |
| 232 | + if (cookie.has_key(self.cookie_name) and |
| 233 | + cookie[self.cookie_name].value != 'deleted'): |
232 | 234 |
|
233 | 235 | # get the session key from the cookie |
234 | | - self.session = cookie['roundup_user_2'].value |
| 236 | + self.session = cookie[self.cookie_name].value |
235 | 237 | # get the user from the session |
236 | 238 | try: |
237 | 239 | # update the lifetime datestamp |
@@ -486,8 +488,8 @@ def set_cookie(self, user): |
486 | 488 |
|
487 | 489 | # generate the cookie path - make sure it has a trailing '/' |
488 | 490 | self.additional_headers['Set-Cookie'] = \ |
489 | | - 'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, |
490 | | - self.cookie_path) |
| 491 | + '%s=%s; expires=%s; Path=%s;'%(self.cookie_name, self.session, |
| 492 | + expire, self.cookie_path) |
491 | 493 |
|
492 | 494 | def make_user_anonymous(self): |
493 | 495 | ''' Make us anonymous |
@@ -583,8 +585,8 @@ def logout_action(self): |
583 | 585 | # construct the logout cookie |
584 | 586 | now = Cookie._getdate() |
585 | 587 | self.additional_headers['Set-Cookie'] = \ |
586 | | - 'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, |
587 | | - self.cookie_path) |
| 588 | + '%s=deleted; Max-Age=0; expires=%s; Path=%s;'%(self.cookie_name, |
| 589 | + now, self.cookie_path) |
588 | 590 |
|
589 | 591 | # Let the user know what's going on |
590 | 592 | self.ok_message.append(_('You are logged out')) |
|
0 commit comments