Skip to content

Commit 396c976

Browse files
author
Richard Jones
committed
Bugfixes
1 parent 5141cd1 commit 396c976

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

roundup-admin

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# $Id: roundup-admin,v 1.6 2001-07-30 00:57:51 richard Exp $
2+
# $Id: roundup-admin,v 1.7 2001-07-30 01:28:46 richard Exp $
33

44
import sys
55
if int(sys.version[0]) < 2:
@@ -92,31 +92,28 @@ def do_init(instance_home, args):
9292
through INSTANCE_HOME or the -i option. The template, backend and admin
9393
password may be specified on the command-line as arguments, in that order.
9494
'''
95-
if len(argv) > n:
96-
template = argv[n]
97-
backend = argv[n+1]
98-
else:
99-
template = backend = ''
100-
10195
# select template
10296
import roundup.templates
10397
templates = roundup.templates.listTemplates()
104-
print 'Templates:', ', '.join(templates)
105-
template = len(args) and args[0] or ''
98+
template = len(args) > 1 and args[1] or ''
99+
if template not in templates:
100+
print 'Templates:', ', '.join(templates)
106101
while template not in templates:
107102
template = raw_input('Select template [classic]: ').strip()
108103
if not template:
109104
template = 'classic'
110105

111106
import roundup.backends
112107
backends = roundup.backends.__all__
113-
backend = len(args) > 1 and args[1] or ''
108+
backend = len(args) > 2 and args[2] or ''
109+
if backend not in backends:
110+
print 'Back ends:', ', '.join(backends)
114111
while backend not in backends:
115112
backend = raw_input('Select backend [anydbm]: ').strip()
116113
if not backend:
117114
backend = 'anydbm'
118-
if len(args) > 2:
119-
adminpw = confirm = args[2]
115+
if len(args) > 3:
116+
adminpw = confirm = args[3]
120117
else:
121118
adminpw = ''
122119
confirm = 'x'
@@ -392,6 +389,10 @@ if __name__ == '__main__':
392389

393390
#
394391
# $Log: not supported by cvs2svn $
392+
# Revision 1.6 2001/07/30 00:57:51 richard
393+
# Now uses getopt, much improved command-line parsing. Much fuller help. Much
394+
# better internal structure. It's just BETTER. :)
395+
#
395396
# Revision 1.5 2001/07/30 00:04:48 richard
396397
# Made the "init" prompting more friendly.
397398
#

0 commit comments

Comments
 (0)