comparison roundup/admin.py @ 3602:064515f658e8

verbose output during import is optional now [SF#1475624]
author Richard Jones <richard@users.sourceforge.net>
date Thu, 27 Apr 2006 03:38:53 +0000
parents 5cd1c83dea50
children 31c79e3aa600
comparison
equal deleted inserted replaced
3601:7b25567f0f54 3602:064515f658e8
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18 # 18 #
19 # $Id: admin.py,v 1.98 2006-02-06 21:00:44 richard Exp $ 19 # $Id: admin.py,v 1.99 2006-04-27 03:38:53 richard Exp $
20 20
21 '''Administration commands for maintaining Roundup trackers. 21 '''Administration commands for maintaining Roundup trackers.
22 ''' 22 '''
23 __docformat__ = 'restructuredtext' 23 __docformat__ = 'restructuredtext'
24 24
119 -c -- when outputting lists of data, comma-separate them. 119 -c -- when outputting lists of data, comma-separate them.
120 Same as '-S ","'. 120 Same as '-S ","'.
121 -S <string> -- when outputting lists of data, string-separate them 121 -S <string> -- when outputting lists of data, string-separate them
122 -s -- when outputting lists of data, space-separate them. 122 -s -- when outputting lists of data, space-separate them.
123 Same as '-S " "'. 123 Same as '-S " "'.
124 -V -- be verbose when importing
125 -v -- report Roundup and Python versions (and quit)
124 126
125 Only one of -s, -c or -S can be specified. 127 Only one of -s, -c or -S can be specified.
126 128
127 Help: 129 Help:
128 roundup-admin -h 130 roundup-admin -h
1157 # loop through the file and create a node for each entry 1159 # loop through the file and create a node for each entry
1158 for n, r in enumerate(reader): 1160 for n, r in enumerate(reader):
1159 if file_props is None: 1161 if file_props is None:
1160 file_props = r 1162 file_props = r
1161 continue 1163 continue
1164
1162 sys.stdout.write('Importing %s - %d\r'%(classname, n)) 1165 sys.stdout.write('Importing %s - %d\r'%(classname, n))
1163 sys.stdout.flush() 1166 sys.stdout.flush()
1164 1167
1165 # do the import and figure the current highest nodeid 1168 # do the import and figure the current highest nodeid
1166 nodeid = int(cl.import_list(file_props, r)) 1169 nodeid = int(cl.import_list(file_props, r))
1410 name = l[0] 1413 name = l[0]
1411 if len(l) > 1: 1414 if len(l) > 1:
1412 password = l[1] 1415 password = l[1]
1413 self.separator = None 1416 self.separator = None
1414 self.print_designator = 0 1417 self.print_designator = 0
1418 self.verbose = 0
1415 for opt, arg in opts: 1419 for opt, arg in opts:
1416 if opt == '-h': 1420 if opt == '-h':
1417 self.usage() 1421 self.usage()
1418 return 0 1422 return 0
1419 if opt == '-v': 1423 elif opt == '-v':
1420 print '%s (python %s)'%(roundup_version, sys.version.split()[0]) 1424 print '%s (python %s)'%(roundup_version, sys.version.split()[0])
1421 return 0 1425 return 0
1422 if opt == '-i': 1426 elif opt == '-V':
1427 self.verbose = 1
1428 elif opt == '-i':
1423 self.tracker_home = arg 1429 self.tracker_home = arg
1424 if opt == '-c': 1430 elif opt == '-c':
1425 if self.separator != None: 1431 if self.separator != None:
1426 self.usage('Only one of -c, -S and -s may be specified') 1432 self.usage('Only one of -c, -S and -s may be specified')
1427 return 1 1433 return 1
1428 self.separator = ',' 1434 self.separator = ','
1429 if opt == '-S': 1435 elif opt == '-S':
1430 if self.separator != None: 1436 if self.separator != None:
1431 self.usage('Only one of -c, -S and -s may be specified') 1437 self.usage('Only one of -c, -S and -s may be specified')
1432 return 1 1438 return 1
1433 self.separator = arg 1439 self.separator = arg
1434 if opt == '-s': 1440 elif opt == '-s':
1435 if self.separator != None: 1441 if self.separator != None:
1436 self.usage('Only one of -c, -S and -s may be specified') 1442 self.usage('Only one of -c, -S and -s may be specified')
1437 return 1 1443 return 1
1438 self.separator = ' ' 1444 self.separator = ' '
1439 if opt == '-d': 1445 elif opt == '-d':
1440 self.print_designator = 1 1446 self.print_designator = 1
1441 1447
1442 # if no command - go interactive 1448 # if no command - go interactive
1443 # wrap in a try/finally so we always close off the db 1449 # wrap in a try/finally so we always close off the db
1444 ret = 0 1450 ret = 0

Roundup Issue Tracker: http://roundup-tracker.org/