Mercurial > p > roundup > code
diff roundup/scripts/roundup_server.py @ 1251:347657425a10
Nicer display of tracker list in roundup-server [SF#619769]
Fixed some missed renaming instance -> tracker [SF#619769]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 08 Oct 2002 03:31:09 +0000 |
| parents | 6c24a86a12ae |
| children | b2d04ce03802 |
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py Tue Oct 08 03:27:24 2002 +0000 +++ b/roundup/scripts/roundup_server.py Tue Oct 08 03:31:09 2002 +0000 @@ -16,7 +16,7 @@ # """ HTTP Server that serves roundup. -$Id: roundup_server.py,v 1.13 2002-10-07 00:52:51 richard Exp $ +$Id: roundup_server.py,v 1.14 2002-10-08 03:31:09 richard Exp $ """ # python version check @@ -96,18 +96,20 @@ do_GET = do_POST = do_HEAD = send_head = run_cgi def index(self): - ''' Print up an index of the available instances + ''' Print up an index of the available trackers ''' self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() w = self.wfile.write - w(_('<html><head><title>Roundup instances index</title></head>\n')) - w(_('<body><h1>Roundup instances index</h1><ol>\n')) - for instance in self.TRACKER_HOMES.keys(): - w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{ - 'instance_url': urllib.quote(instance), - 'instance_name': cgi.escape(instance)}) + w(_('<html><head><title>Roundup trackers index</title></head>\n')) + w(_('<body><h1>Roundup trackers index</h1><ol>\n')) + keys = self.TRACKER_HOMES.keys() + keys.sort() + for tracker in keys: + w(_('<li><a href="%(tracker_url)s/index">%(tracker_name)s</a>\n')%{ + 'tracker_url': urllib.quote(tracker), + 'tracker_name': cgi.escape(tracker)}) w(_('</ol></body></html>')) def inner_run_cgi(self): @@ -121,14 +123,14 @@ else: query = '' - # figure the instance + # figure the tracker if rest == '/': return self.index() l_path = rest.split('/') - instance_name = urllib.unquote(l_path[1]) - if self.TRACKER_HOMES.has_key(instance_name): - instance_home = self.TRACKER_HOMES[instance_name] - instance = roundup.instance.open(instance_home) + tracker_name = urllib.unquote(l_path[1]) + if self.TRACKER_HOMES.has_key(tracker_name): + tracker_home = self.TRACKER_HOMES[tracker_name] + tracker = roundup.instance.open(tracker_home) else: raise client.NotFound @@ -140,7 +142,7 @@ # Set up the CGI environment env = {} - env['TRACKER_NAME'] = instance_name + env['TRACKER_NAME'] = tracker_name env['REQUEST_METHOD'] = self.command env['PATH_INFO'] = urllib.unquote(rest) if query: @@ -164,24 +166,24 @@ decoded_query = query.replace('+', ' ') # do the roundup thang - c = instance.Client(instance, self, env) + c = tracker.Client(tracker, self, env) c.main() def usage(message=''): if message: message = _('Error: %(error)s\n\n')%{'error': message} print _('''%(message)sUsage: -roundup-server [-n hostname] [-p port] [-l file] [-d file] [name=instance home]* +roundup-server [-n hostname] [-p port] [-l file] [-d file] [name=tracker home]* -n: sets the host name -p: sets the port to listen on -l: sets a filename to log to (instead of stdout) -d: daemonize, and write the server's PID to the nominated file - name=instance home - Sets the instance home(s) to use. The name is how the instance is + name=tracker home + Sets the tracker home(s) to use. The name is how the tracker is identified in the URL (it's the first part of the URL path). The - instance home is the directory that was identified when you did + tracker home is the directory that was identified when you did "roundup-admin init". You may specify any number of these name=home pairs on the command-line. For convenience, you may edit the TRACKER_HOMES variable in the roundup-server file instead. @@ -276,7 +278,7 @@ if not os.getuid() and user is None: raise ValueError, _("Can't run as root!") - # handle instance specs + # handle tracker specs if args: d = {} for arg in args:
