Mercurial > p > roundup > code
diff cgi-bin/roundup.cgi @ 1096:fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 10 Sep 2002 03:01:20 +0000 |
| parents | e5826025eeb7 |
| children | 26c8cb2162d7 |
line wrap: on
line diff
--- a/cgi-bin/roundup.cgi Tue Sep 10 02:37:28 2002 +0000 +++ b/cgi-bin/roundup.cgi Tue Sep 10 03:01:20 2002 +0000 @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup.cgi,v 1.30 2002-09-10 01:07:05 richard Exp $ +# $Id: roundup.cgi,v 1.31 2002-09-10 03:01:17 richard Exp $ # python version check from roundup import version_check @@ -32,7 +32,7 @@ # documented below are set, they _override_ any configuation defaults # given in this file. -# ROUNDUP_INSTANCE_HOMES is a list of instances, in the form +# TRACKER_HOMES is a list of instances, in the form # "NAME=DIR<sep>NAME2=DIR2<sep>...", where <sep> is the directory path # separator (";" on Windows, ":" on Unix). @@ -43,7 +43,7 @@ # used in the code. Higher numbers means more debugging output. # This indicates where the Roundup instance lives -ROUNDUP_INSTANCE_HOMES = { +TRACKER_HOMES = { 'demo': '/var/roundup/instances/demo', } @@ -81,11 +81,16 @@ # def checkconfig(): import os, string - global ROUNDUP_INSTANCE_HOMES, LOG + global TRACKER_HOMES, LOG - homes = os.environ.get('ROUNDUP_INSTANCE_HOMES', '') + # see if there's an environment var. ROUNDUP_INSTANCE_HOMES is the + # old name for it. + if os.environ.has_key('ROUNDUP_INSTANCE_HOMES'): + homes = os.environ.get('ROUNDUP_INSTANCE_HOMES') + else: + homes = os.environ.get('TRACKER_HOMES', '') if homes: - ROUNDUP_INSTANCE_HOMES = {} + TRACKER_HOMES = {} for home in string.split(homes, os.pathsep): try: name, dir = string.split(home, '=', 1) @@ -93,7 +98,7 @@ # ignore invalid definitions continue if name and dir: - ROUNDUP_INSTANCE_HOMES[name] = dir + TRACKER_HOMES[name] = dir logname = os.environ.get('ROUNDUP_LOG', '') if logname: @@ -129,9 +134,9 @@ request = RequestWrapper(out) request.path = os.environ.get('PATH_INFO', '/') instance = path[1] - os.environ['INSTANCE_NAME'] = instance + os.environ['TRACKER_NAME'] = instance os.environ['PATH_INFO'] = string.join(path[2:], '/') - if ROUNDUP_INSTANCE_HOMES.has_key(instance): + if TRACKER_HOMES.has_key(instance): # redirect if we need a trailing '/' if len(path) == 2: request.send_response(301) @@ -141,7 +146,7 @@ request.end_headers() out.write('Moved Permanently') else: - instance_home = ROUNDUP_INSTANCE_HOMES[instance] + instance_home = TRACKER_HOMES[instance] instance = roundup.instance.open(instance_home) from roundup.cgi.client import Unauthorised, NotFound client = instance.Client(instance, request, os.environ) @@ -166,7 +171,7 @@ w = request.write w(_('<html><head><title>Roundup instances index</title></head>\n')) w(_('<body><h1>Roundup instances index</h1><ol>\n')) - homes = ROUNDUP_INSTANCE_HOMES.keys() + homes = TRACKER_HOMES.keys() homes.sort() for instance in homes: w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{
