Skip to content

Commit 740b711

Browse files
author
Richard Jones
committed
attempt to fix the template finding
1 parent 73a2ca5 commit 740b711

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

roundup/admin.py

Lines changed: 14 additions & 10 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: admin.py,v 1.53 2003-05-09 03:32:41 richard Exp $
19+
# $Id: admin.py,v 1.54 2003-05-29 00:42:34 richard Exp $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
@@ -289,17 +289,21 @@ def listTemplates(self):
289289
'''
290290
# OK, try <prefix>/share/roundup/templates
291291
# -- this module (roundup.admin) will be installed in something
292-
# _like_ /usr/lib/python2.2/site-packages/roundup/admin.py, and
292+
# like:
293+
# /usr/lib/python2.2/site-packages/roundup/admin.py (5 dirs up)
294+
# c:\python22\lib\site-packages\roundup\admin.py (4 dirs up)
293295
# we're interested in where the "lib" directory is - ie. the /usr/
294296
# part
295-
path = __file__
296-
for i in range(5):
297-
path = os.path.dirname(path)
298-
tdir = os.path.join(path, 'share', 'roundup', 'templates')
299-
if os.path.isdir(tdir):
300-
templates = listTemplates(tdir)
301-
else:
302-
templates = {}
297+
templates = {}
298+
for N in 4, 5:
299+
path = __file__
300+
# move up N elements in the path
301+
for i in range(N):
302+
path = os.path.dirname(path)
303+
tdir = os.path.join(path, 'share', 'roundup', 'templates')
304+
if os.path.isdir(tdir):
305+
templates = listTemplates(tdir)
306+
break
303307

304308
# OK, now try as if we're in the roundup source distribution
305309
# directory, so this module will be in .../roundup-*/roundup/admin.py

0 commit comments

Comments
 (0)