|
16 | 16 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
17 | 17 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
18 | 18 | # |
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 $ |
20 | 20 |
|
21 | 21 | '''Administration commands for maintaining Roundup trackers. |
22 | 22 | ''' |
@@ -289,17 +289,21 @@ def listTemplates(self): |
289 | 289 | ''' |
290 | 290 | # OK, try <prefix>/share/roundup/templates |
291 | 291 | # -- 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) |
293 | 295 | # we're interested in where the "lib" directory is - ie. the /usr/ |
294 | 296 | # 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 |
303 | 307 |
|
304 | 308 | # OK, now try as if we're in the roundup source distribution |
305 | 309 | # directory, so this module will be in .../roundup-*/roundup/admin.py |
|
0 commit comments