From 645354f87b016edbce94885ad9887c5d4207ea4f Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 8 Oct 2002 03:31:09 +0000 Subject: [PATCH] - nicer display of tracker list in roundup-server (sf bug 619769) - fixed some missed renaming instance -> tracker (sf bug 619769) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1324 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 2 ++ cgi-bin/roundup.cgi | 33 ++++++++++++------------ roundup/scripts/roundup_server.py | 42 ++++++++++++++++--------------- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index d9f3fc9..665dd35 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,8 @@ are given with the most recent entry first. - fixed log / pid file path handling in roundup-server (sf bug 617981) - fixed old gadfly compatibiltiy problem, for sure this time (sf bug 612873) - https URLs from config now recognised as valid (sf bug 619829) +- nicer display of tracker list in roundup-server (sf bug 619769) +- fixed some missed renaming instance -> tracker (sf bug 619769) 2002-10-02 0.5.0 diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi index 1518c40..22cf5cf 100755 --- a/cgi-bin/roundup.cgi +++ b/cgi-bin/roundup.cgi @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup.cgi,v 1.33 2002-09-23 00:50:32 richard Exp $ +# $Id: roundup.cgi,v 1.34 2002-10-08 03:31:09 richard Exp $ # python version check from roundup import version_check @@ -32,7 +32,7 @@ import sys # documented below are set, they _override_ any configuation defaults # given in this file. -# TRACKER_HOMES is a list of instances, in the form +# TRACKER_HOMES is a list of trackers, in the form # "NAME=DIRNAME2=DIR2...", where is the directory path # separator (";" on Windows, ":" on Unix). @@ -45,9 +45,9 @@ import sys # ROUNDUP_DEBUG is a debug level, currently only 0 (OFF) and 1 (ON) are # used in the code. Higher numbers means more debugging output. -# This indicates where the Roundup instance lives +# This indicates where the Roundup tracker lives TRACKER_HOMES = { - 'demo': '/var/roundup/instances/demo', + 'demo': '/var/roundup/trackers/demo', } # Where to log debugging information to. Use an instance of DevNull if you @@ -136,10 +136,10 @@ def main(out, err): path = string.split(os.environ.get('PATH_INFO', '/'), '/') request = RequestWrapper(out) request.path = os.environ.get('PATH_INFO', '/') - instance = path[1] - os.environ['TRACKER_NAME'] = instance + tracker = path[1] + os.environ['TRACKER_NAME'] = tracker os.environ['PATH_INFO'] = string.join(path[2:], '/') - if TRACKER_HOMES.has_key(instance): + if TRACKER_HOMES.has_key(tracker): # redirect if we need a trailing '/' if len(path) == 2: request.send_response(301) @@ -154,10 +154,10 @@ def main(out, err): request.end_headers() out.write('Moved Permanently') else: - instance_home = TRACKER_HOMES[instance] - instance = roundup.instance.open(instance_home) + tracker_home = TRACKER_HOMES[tracker] + tracker = roundup.instance.open(tracker_home) from roundup.cgi.client import Unauthorised, NotFound - client = instance.Client(instance, request, os.environ) + client = tracker.Client(tracker, request, os.environ) try: client.main() except Unauthorised: @@ -177,14 +177,15 @@ def main(out, err): request.send_header('Content-Type', 'text/html') request.end_headers() w = request.write - w(_('Roundup instances index\n')) - w(_('

Roundup instances index

    \n')) + w(_('Roundup trackers index\n')) + w(_('

    Roundup trackers index

      \n')) homes = TRACKER_HOMES.keys() homes.sort() - for instance in homes: - w(_('
    1. %(instance_name)s\n')%{ - 'instance_url': os.environ['SCRIPT_NAME']+'/'+urllib.quote(instance), - 'instance_name': cgi.escape(instance)}) + for tracker in homes: + w(_('
    2. %(tracker_name)s\n')%{ + 'tracker_url': os.environ['SCRIPT_NAME']+'/'+ + urllib.quote(tracker), + 'tracker_name': cgi.escape(tracker)}) w(_('
    ')) # diff --git a/roundup/scripts/roundup_server.py b/roundup/scripts/roundup_server.py index 86f8444..4f4b213 100644 --- a/roundup/scripts/roundup_server.py +++ b/roundup/scripts/roundup_server.py @@ -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 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): 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(_('Roundup instances index\n')) - w(_('

    Roundup instances index

      \n')) - for instance in self.TRACKER_HOMES.keys(): - w(_('
    1. %(instance_name)s\n')%{ - 'instance_url': urllib.quote(instance), - 'instance_name': cgi.escape(instance)}) + w(_('Roundup trackers index\n')) + w(_('

      Roundup trackers index

        \n')) + keys = self.TRACKER_HOMES.keys() + keys.sort() + for tracker in keys: + w(_('
      1. %(tracker_name)s\n')%{ + 'tracker_url': urllib.quote(tracker), + 'tracker_name': cgi.escape(tracker)}) w(_('
      ')) def inner_run_cgi(self): @@ -121,14 +123,14 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): 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 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): # 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 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): 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 @@ def run(): 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: -- 2.30.2