Fix to issue #16: escalate_tickets fails with an error due to conflicting command-line arguments

This commit is contained in:
Ross Poulton 2011-02-02 07:49:44 +00:00
parent c3dd8e8be0
commit 8435a665b1

View File

@ -27,10 +27,10 @@ class Command(BaseCommand):
self.option_list += ( self.option_list += (
make_option( make_option(
'--queues', '-q', '--queues',
help='Queues to include (default: all). Use queue slugs'), help='Queues to include (default: all). Use queue slugs'),
make_option( make_option(
'--verbose', '-v', '--verboseescalation',
action='store_true', action='store_true',
default=False, default=False,
help='Display a list of dates excluded'), help='Display a list of dates excluded'),
@ -41,7 +41,7 @@ class Command(BaseCommand):
queue_slugs = None queue_slugs = None
queues = [] queues = []
if options['verbose']: if options['verboseescalation']:
verbose = True verbose = True
if options['queues']: if options['queues']:
queue_slugs = options['queues'] queue_slugs = options['queues']
@ -158,13 +158,13 @@ def escalate_tickets(queues, verbose):
def usage(): def usage():
print "Options:" print "Options:"
print " --queues, -q: Queues to include (default: all). Use queue slugs" print " --queues: Queues to include (default: all). Use queue slugs"
print " --verbose, -v: Display a list of dates excluded" print " --verboseescalation: Display a list of dates excluded"
if __name__ == '__main__': if __name__ == '__main__':
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'q:v', ['queues=', 'verbose']) opts, args = getopt.getopt(sys.argv[1:], ['queues=', 'verboseescalation'])
except getopt.GetoptError: except getopt.GetoptError:
usage() usage()
sys.exit(2) sys.exit(2)
@ -174,9 +174,9 @@ if __name__ == '__main__':
queues = [] queues = []
for o, a in opts: for o, a in opts:
if o in ('-v', '--verbose'): if o == '--verboseescalation':
verbose = True verbose = True
if o in ('-q', '--queues'): if o == '--queues':
queue_slugs = a queue_slugs = a
if queue_slugs is not None: if queue_slugs is not None: