Skip to content

Commit 2a3bd60

Browse files
author
Richard Jones
committed
backporting fixes from HEAD
1 parent 5211bdc commit 2a3bd60

File tree

4 files changed

+37
-34
lines changed

4 files changed

+37
-34
lines changed

CHANGES.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4-
5-
2003-??-?? 0.5.5
4+
2003-01-24 0.5.5
65
- fixed rdbms searching by ID (sf bug 666615)
6+
- fixed metakit searching by ID
77
- detect corrupted index and raise semi-useful exception (sf bug 666767)
88
- open server logfile unbuffered
99
- revert StringHTMLProperty to not hyperlink text by default
1010
- fixes to CGI form handling
1111
- fix unlink bug in metakit backend
12-
- fixed metakit searching by ID
12+
- fixed hyperlinking ambiguity (sf bug 669777)
13+
- fixed cookie path to use TRACKER_WEB (sf bug 667020) (thanks Nathaniel Smith
14+
for helping chase it down and Luke Opperman for confirming fix)
1315

1416

1517
2003-01-10 0.5.4

roundup/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: __init__.py,v 1.18 2003-01-09 22:59:20 richard Exp $
18+
# $Id: __init__.py,v 1.18.2.1 2003-01-24 06:25:15 richard Exp $
1919

2020
''' Roundup - issue tracking for knowledge workers.
2121
@@ -67,6 +67,6 @@
6767
much prettier cake :)
6868
'''
6969

70-
__version__ = '0.5.4'
70+
__version__ = '0.5.5'
7171

7272
# vim: set filetype=python ts=4 sw=4 et si

roundup/cgi/client.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.65.2.1 2003-01-15 22:38:14 richard Exp $
1+
# $Id: client.py,v 1.65.2.2 2003-01-24 06:25:16 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -92,6 +92,10 @@ def __init__(self, instance, request, env, form=None):
9292
# this is the base URL for this instance
9393
self.base = self.instance.config.TRACKER_WEB
9494

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]
98+
9599
# see if we need to re-parse the environment for the form (eg Zope)
96100
if form is None:
97101
self.form = cgi.FieldStorage(environ=env)
@@ -470,10 +474,9 @@ def set_cookie(self, user):
470474
expire = Cookie._getdate(86400*365)
471475

472476
# generate the cookie path - make sure it has a trailing '/'
473-
path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
474-
''))
475477
self.additional_headers['Set-Cookie'] = \
476-
'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, path)
478+
'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire,
479+
self.cookie_path)
477480

478481
def make_user_anonymous(self):
479482
''' Make us anonymous
@@ -568,10 +571,9 @@ def logout_action(self):
568571

569572
# construct the logout cookie
570573
now = Cookie._getdate()
571-
path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
572-
''))
573574
self.additional_headers['Set-Cookie'] = \
574-
'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)
575+
'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now,
576+
self.cookie_path)
575577

576578
# Let the user know what's going on
577579
self.ok_message.append(_('You are logged out'))

roundup/cgi/templating.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -734,25 +734,26 @@ def __cmp__(self, other):
734734
return cmp(self._value, other)
735735

736736
class StringHTMLProperty(HTMLProperty):
737-
url_re = re.compile(r'\w{3,6}://\S+')
738-
email_re = re.compile(r'\w+@[\w\.\-]+')
739-
designator_re = re.compile(r'([a-z_]+)(\d+)')
740-
def _url_repl(self, match):
741-
s = match.group(0)
742-
return '<a href="%s">%s</a>'%(s, s)
743-
def _email_repl(self, match):
744-
s = match.group(0)
745-
return '<a href="mailto:%s">%s</a>'%(s, s)
746-
def _designator_repl(self, match):
747-
s = match.group(0)
748-
s1 = match.group(1)
749-
s2 = match.group(2)
750-
try:
751-
# make sure s1 is a valid tracker classname
752-
self._db.getclass(s1)
753-
return '<a href="%s">%s %s</a>'%(s, s1, s2)
754-
except KeyError:
755-
return '%s%s'%(s1, s2)
737+
hyper_re = re.compile(r'((?P<url>\w{3,6}://\S+)|'
738+
r'(?P<email>[\w\.]+@[\w\.\-]+)|'
739+
r'(?P<item>(?P<class>[a-z_]+)(?P<id>\d+)))')
740+
def _hyper_repl(self, match):
741+
if match.group('url'):
742+
s = match.group('url')
743+
return '<a href="%s">%s</a>'%(s, s)
744+
elif match.group('email'):
745+
s = match.group('email')
746+
return '<a href="mailto:%s">%s</a>'%(s, s)
747+
else:
748+
s = match.group('item')
749+
s1 = match.group('class')
750+
s2 = match.group('id')
751+
try:
752+
# make sure s1 is a valid tracker classname
753+
self._db.getclass(s1)
754+
return '<a href="%s">%s %s</a>'%(s, s1, s2)
755+
except KeyError:
756+
return '%s%s'%(s1, s2)
756757

757758
def plain(self, escape=0, hyperlink=0):
758759
''' Render a "plain" representation of the property
@@ -770,9 +771,7 @@ def plain(self, escape=0, hyperlink=0):
770771
if hyperlink:
771772
if not escape:
772773
s = cgi.escape(s)
773-
s = self.url_re.sub(self._url_repl, s)
774-
s = self.email_re.sub(self._email_repl, s)
775-
s = self.designator_re.sub(self._designator_repl, s)
774+
s = self.hyper_re.sub(self._hyper_repl, s)
776775
return s
777776

778777
def stext(self, escape=0):

0 commit comments

Comments
 (0)