Skip to content

Commit e183610

Browse files
author
Richard Jones
committed
Nicer display of tracker list in roundup-server [SF#619769]
Fixed some missed renaming instance -> tracker [SF#619769]
1 parent 753e8d6 commit e183610

File tree

3 files changed

+41
-36
lines changed

3 files changed

+41
-36
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ are given with the most recent entry first.
1111
- fixed log / pid file path handling in roundup-server (sf bug 617981)
1212
- fixed old gadfly compatibiltiy problem, for sure this time (sf bug 612873)
1313
- https URLs from config now recognised as valid (sf bug 619829)
14+
- nicer display of tracker list in roundup-server (sf bug 619769)
15+
- fixed some missed renaming instance -> tracker (sf bug 619769)
1416

1517

1618
2002-10-02 0.5.0

cgi-bin/roundup.cgi

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup.cgi,v 1.33 2002-09-23 00:50:32 richard Exp $
19+
# $Id: roundup.cgi,v 1.34 2002-10-08 03:31:09 richard Exp $
2020

2121
# python version check
2222
from roundup import version_check
@@ -32,7 +32,7 @@ import sys
3232
# documented below are set, they _override_ any configuation defaults
3333
# given in this file.
3434

35-
# TRACKER_HOMES is a list of instances, in the form
35+
# TRACKER_HOMES is a list of trackers, in the form
3636
# "NAME=DIR<sep>NAME2=DIR2<sep>...", where <sep> is the directory path
3737
# separator (";" on Windows, ":" on Unix).
3838

@@ -45,9 +45,9 @@ import sys
4545
# ROUNDUP_DEBUG is a debug level, currently only 0 (OFF) and 1 (ON) are
4646
# used in the code. Higher numbers means more debugging output.
4747

48-
# This indicates where the Roundup instance lives
48+
# This indicates where the Roundup tracker lives
4949
TRACKER_HOMES = {
50-
'demo': '/var/roundup/instances/demo',
50+
'demo': '/var/roundup/trackers/demo',
5151
}
5252

5353
# Where to log debugging information to. Use an instance of DevNull if you
@@ -136,10 +136,10 @@ def main(out, err):
136136
path = string.split(os.environ.get('PATH_INFO', '/'), '/')
137137
request = RequestWrapper(out)
138138
request.path = os.environ.get('PATH_INFO', '/')
139-
instance = path[1]
140-
os.environ['TRACKER_NAME'] = instance
139+
tracker = path[1]
140+
os.environ['TRACKER_NAME'] = tracker
141141
os.environ['PATH_INFO'] = string.join(path[2:], '/')
142-
if TRACKER_HOMES.has_key(instance):
142+
if TRACKER_HOMES.has_key(tracker):
143143
# redirect if we need a trailing '/'
144144
if len(path) == 2:
145145
request.send_response(301)
@@ -154,10 +154,10 @@ def main(out, err):
154154
request.end_headers()
155155
out.write('Moved Permanently')
156156
else:
157-
instance_home = TRACKER_HOMES[instance]
158-
instance = roundup.instance.open(instance_home)
157+
tracker_home = TRACKER_HOMES[tracker]
158+
tracker = roundup.instance.open(tracker_home)
159159
from roundup.cgi.client import Unauthorised, NotFound
160-
client = instance.Client(instance, request, os.environ)
160+
client = tracker.Client(tracker, request, os.environ)
161161
try:
162162
client.main()
163163
except Unauthorised:
@@ -177,14 +177,15 @@ def main(out, err):
177177
request.send_header('Content-Type', 'text/html')
178178
request.end_headers()
179179
w = request.write
180-
w(_('<html><head><title>Roundup instances index</title></head>\n'))
181-
w(_('<body><h1>Roundup instances index</h1><ol>\n'))
180+
w(_('<html><head><title>Roundup trackers index</title></head>\n'))
181+
w(_('<body><h1>Roundup trackers index</h1><ol>\n'))
182182
homes = TRACKER_HOMES.keys()
183183
homes.sort()
184-
for instance in homes:
185-
w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{
186-
'instance_url': os.environ['SCRIPT_NAME']+'/'+urllib.quote(instance),
187-
'instance_name': cgi.escape(instance)})
184+
for tracker in homes:
185+
w(_('<li><a href="%(tracker_url)s/index">%(tracker_name)s</a>\n')%{
186+
'tracker_url': os.environ['SCRIPT_NAME']+'/'+
187+
urllib.quote(tracker),
188+
'tracker_name': cgi.escape(tracker)})
188189
w(_('</ol></body></html>'))
189190

190191
#

roundup/scripts/roundup_server.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
""" HTTP Server that serves roundup.
1818
19-
$Id: roundup_server.py,v 1.13 2002-10-07 00:52:51 richard Exp $
19+
$Id: roundup_server.py,v 1.14 2002-10-08 03:31:09 richard Exp $
2020
"""
2121

2222
# python version check
@@ -96,18 +96,20 @@ def run_cgi(self):
9696
do_GET = do_POST = do_HEAD = send_head = run_cgi
9797

9898
def index(self):
99-
''' Print up an index of the available instances
99+
''' Print up an index of the available trackers
100100
'''
101101
self.send_response(200)
102102
self.send_header('Content-Type', 'text/html')
103103
self.end_headers()
104104
w = self.wfile.write
105-
w(_('<html><head><title>Roundup instances index</title></head>\n'))
106-
w(_('<body><h1>Roundup instances index</h1><ol>\n'))
107-
for instance in self.TRACKER_HOMES.keys():
108-
w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{
109-
'instance_url': urllib.quote(instance),
110-
'instance_name': cgi.escape(instance)})
105+
w(_('<html><head><title>Roundup trackers index</title></head>\n'))
106+
w(_('<body><h1>Roundup trackers index</h1><ol>\n'))
107+
keys = self.TRACKER_HOMES.keys()
108+
keys.sort()
109+
for tracker in keys:
110+
w(_('<li><a href="%(tracker_url)s/index">%(tracker_name)s</a>\n')%{
111+
'tracker_url': urllib.quote(tracker),
112+
'tracker_name': cgi.escape(tracker)})
111113
w(_('</ol></body></html>'))
112114

113115
def inner_run_cgi(self):
@@ -121,14 +123,14 @@ def inner_run_cgi(self):
121123
else:
122124
query = ''
123125

124-
# figure the instance
126+
# figure the tracker
125127
if rest == '/':
126128
return self.index()
127129
l_path = rest.split('/')
128-
instance_name = urllib.unquote(l_path[1])
129-
if self.TRACKER_HOMES.has_key(instance_name):
130-
instance_home = self.TRACKER_HOMES[instance_name]
131-
instance = roundup.instance.open(instance_home)
130+
tracker_name = urllib.unquote(l_path[1])
131+
if self.TRACKER_HOMES.has_key(tracker_name):
132+
tracker_home = self.TRACKER_HOMES[tracker_name]
133+
tracker = roundup.instance.open(tracker_home)
132134
else:
133135
raise client.NotFound
134136

@@ -140,7 +142,7 @@ def inner_run_cgi(self):
140142

141143
# Set up the CGI environment
142144
env = {}
143-
env['TRACKER_NAME'] = instance_name
145+
env['TRACKER_NAME'] = tracker_name
144146
env['REQUEST_METHOD'] = self.command
145147
env['PATH_INFO'] = urllib.unquote(rest)
146148
if query:
@@ -164,24 +166,24 @@ def inner_run_cgi(self):
164166
decoded_query = query.replace('+', ' ')
165167

166168
# do the roundup thang
167-
c = instance.Client(instance, self, env)
169+
c = tracker.Client(tracker, self, env)
168170
c.main()
169171

170172
def usage(message=''):
171173
if message:
172174
message = _('Error: %(error)s\n\n')%{'error': message}
173175
print _('''%(message)sUsage:
174-
roundup-server [-n hostname] [-p port] [-l file] [-d file] [name=instance home]*
176+
roundup-server [-n hostname] [-p port] [-l file] [-d file] [name=tracker home]*
175177
176178
-n: sets the host name
177179
-p: sets the port to listen on
178180
-l: sets a filename to log to (instead of stdout)
179181
-d: daemonize, and write the server's PID to the nominated file
180182
181-
name=instance home
182-
Sets the instance home(s) to use. The name is how the instance is
183+
name=tracker home
184+
Sets the tracker home(s) to use. The name is how the tracker is
183185
identified in the URL (it's the first part of the URL path). The
184-
instance home is the directory that was identified when you did
186+
tracker home is the directory that was identified when you did
185187
"roundup-admin init". You may specify any number of these name=home
186188
pairs on the command-line. For convenience, you may edit the
187189
TRACKER_HOMES variable in the roundup-server file instead.
@@ -276,7 +278,7 @@ def run():
276278
if not os.getuid() and user is None:
277279
raise ValueError, _("Can't run as root!")
278280

279-
# handle instance specs
281+
# handle tracker specs
280282
if args:
281283
d = {}
282284
for arg in args:

0 commit comments

Comments
 (0)