1616# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818#
19- # $Id: roundup.cgi,v 1.30 2002-09-10 01:07:05 richard Exp $
19+ # $Id: roundup.cgi,v 1.31 2002-09-10 03: 01:17 richard Exp $
2020
2121# python version check
2222from 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- # ROUNDUP_INSTANCE_HOMES is a list of instances, in the form
35+ # TRACKER_HOMES is a list of instances, in the form
3636# "NAME=DIR<sep>NAME2=DIR2<sep>...", where <sep> is the directory path
3737# separator (";" on Windows, ":" on Unix).
3838
@@ -43,7 +43,7 @@ import sys
4343# used in the code. Higher numbers means more debugging output.
4444
4545# This indicates where the Roundup instance lives
46- ROUNDUP_INSTANCE_HOMES = {
46+ TRACKER_HOMES = {
4747 'demo' : '/var/roundup/instances/demo' ,
4848}
4949
@@ -81,19 +81,24 @@ except:
8181#
8282def checkconfig ():
8383 import os , string
84- global ROUNDUP_INSTANCE_HOMES , LOG
84+ global TRACKER_HOMES , LOG
8585
86- homes = os .environ .get ('ROUNDUP_INSTANCE_HOMES' , '' )
86+ # see if there's an environment var. ROUNDUP_INSTANCE_HOMES is the
87+ # old name for it.
88+ if os .environ .has_key ('ROUNDUP_INSTANCE_HOMES' ):
89+ homes = os .environ .get ('ROUNDUP_INSTANCE_HOMES' )
90+ else :
91+ homes = os .environ .get ('TRACKER_HOMES' , '' )
8792 if homes :
88- ROUNDUP_INSTANCE_HOMES = {}
93+ TRACKER_HOMES = {}
8994 for home in string .split (homes , os .pathsep ):
9095 try :
9196 name , dir = string .split (home , '=' , 1 )
9297 except ValueError :
9398 # ignore invalid definitions
9499 continue
95100 if name and dir :
96- ROUNDUP_INSTANCE_HOMES [name ] = dir
101+ TRACKER_HOMES [name ] = dir
97102
98103 logname = os .environ .get ('ROUNDUP_LOG' , '' )
99104 if logname :
@@ -129,9 +134,9 @@ def main(out, err):
129134 request = RequestWrapper (out )
130135 request .path = os .environ .get ('PATH_INFO' , '/' )
131136 instance = path [1 ]
132- os .environ ['INSTANCE_NAME ' ] = instance
137+ os .environ ['TRACKER_NAME ' ] = instance
133138 os .environ ['PATH_INFO' ] = string .join (path [2 :], '/' )
134- if ROUNDUP_INSTANCE_HOMES .has_key (instance ):
139+ if TRACKER_HOMES .has_key (instance ):
135140 # redirect if we need a trailing '/'
136141 if len (path ) == 2 :
137142 request .send_response (301 )
@@ -141,7 +146,7 @@ def main(out, err):
141146 request .end_headers ()
142147 out .write ('Moved Permanently' )
143148 else :
144- instance_home = ROUNDUP_INSTANCE_HOMES [instance ]
149+ instance_home = TRACKER_HOMES [instance ]
145150 instance = roundup .instance .open (instance_home )
146151 from roundup .cgi .client import Unauthorised , NotFound
147152 client = instance .Client (instance , request , os .environ )
@@ -166,7 +171,7 @@ def main(out, err):
166171 w = request .write
167172 w (_ ('<html><head><title>Roundup instances index</title></head>\n ' ))
168173 w (_ ('<body><h1>Roundup instances index</h1><ol>\n ' ))
169- homes = ROUNDUP_INSTANCE_HOMES .keys ()
174+ homes = TRACKER_HOMES .keys ()
170175 homes .sort ()
171176 for instance in homes :
172177 w (_ ('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n ' )% {
0 commit comments