Mercurial > p > roundup > code
comparison roundup-admin @ 147:0e3cb7a4290f
Bugfixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 30 Jul 2001 01:28:46 +0000 |
| parents | a4383d62a407 |
| children | b07b9a5b6aa9 |
comparison
equal
deleted
inserted
replaced
| 146:da7b97149caa | 147:0e3cb7a4290f |
|---|---|
| 1 #! /usr/bin/python | 1 #! /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 $ |
| 3 | 3 |
| 4 import sys | 4 import sys |
| 5 if int(sys.version[0]) < 2: | 5 if int(sys.version[0]) < 2: |
| 6 print 'Roundup requires python 2.0 or later.' | 6 print 'Roundup requires python 2.0 or later.' |
| 7 sys.exit(1) | 7 sys.exit(1) |
| 90 | 90 |
| 91 The command will prompt for the instance home directory (if not supplied | 91 The command will prompt for the instance home directory (if not supplied |
| 92 through INSTANCE_HOME or the -i option. The template, backend and admin | 92 through INSTANCE_HOME or the -i option. The template, backend and admin |
| 93 password may be specified on the command-line as arguments, in that order. | 93 password may be specified on the command-line as arguments, in that order. |
| 94 ''' | 94 ''' |
| 95 if len(argv) > n: | |
| 96 template = argv[n] | |
| 97 backend = argv[n+1] | |
| 98 else: | |
| 99 template = backend = '' | |
| 100 | |
| 101 # select template | 95 # select template |
| 102 import roundup.templates | 96 import roundup.templates |
| 103 templates = roundup.templates.listTemplates() | 97 templates = roundup.templates.listTemplates() |
| 104 print 'Templates:', ', '.join(templates) | 98 template = len(args) > 1 and args[1] or '' |
| 105 template = len(args) and args[0] or '' | 99 if template not in templates: |
| 100 print 'Templates:', ', '.join(templates) | |
| 106 while template not in templates: | 101 while template not in templates: |
| 107 template = raw_input('Select template [classic]: ').strip() | 102 template = raw_input('Select template [classic]: ').strip() |
| 108 if not template: | 103 if not template: |
| 109 template = 'classic' | 104 template = 'classic' |
| 110 | 105 |
| 111 import roundup.backends | 106 import roundup.backends |
| 112 backends = roundup.backends.__all__ | 107 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) | |
| 114 while backend not in backends: | 111 while backend not in backends: |
| 115 backend = raw_input('Select backend [anydbm]: ').strip() | 112 backend = raw_input('Select backend [anydbm]: ').strip() |
| 116 if not backend: | 113 if not backend: |
| 117 backend = 'anydbm' | 114 backend = 'anydbm' |
| 118 if len(args) > 2: | 115 if len(args) > 3: |
| 119 adminpw = confirm = args[2] | 116 adminpw = confirm = args[3] |
| 120 else: | 117 else: |
| 121 adminpw = '' | 118 adminpw = '' |
| 122 confirm = 'x' | 119 confirm = 'x' |
| 123 while adminpw != confirm: | 120 while adminpw != confirm: |
| 124 adminpw = getpass.getpass('Admin Password: ') | 121 adminpw = getpass.getpass('Admin Password: ') |
| 390 if __name__ == '__main__': | 387 if __name__ == '__main__': |
| 391 sys.exit(main()) | 388 sys.exit(main()) |
| 392 | 389 |
| 393 # | 390 # |
| 394 # $Log: not supported by cvs2svn $ | 391 # $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 # | |
| 395 # Revision 1.5 2001/07/30 00:04:48 richard | 396 # Revision 1.5 2001/07/30 00:04:48 richard |
| 396 # Made the "init" prompting more friendly. | 397 # Made the "init" prompting more friendly. |
| 397 # | 398 # |
| 398 # Revision 1.4 2001/07/29 07:01:39 richard | 399 # Revision 1.4 2001/07/29 07:01:39 richard |
| 399 # Added vim command to all source so that we don't get no steenkin' tabs :) | 400 # Added vim command to all source so that we don't get no steenkin' tabs :) |
