+ elif prog in [POST_SUBMIT, FAILED_SUBMIT]:
+ if len(args) != 4:
+ parser.set_usage('Usage: %prog [options] pocket package commit principal')
+ parser.print_help()
+ return 2
+ values = { 'pocket' : args[0],
+ 'package' : args[1],
+ 'commit' : args[2],
+ 'principal' : args[3],
+ 'default_instance' : 'submission',
+ 'default_subject' : 'Submission %(result)s: %(package)s %(version)s in %(pocket)s'}
+ if prog == POST_SUBMIT:
+ values['result'] = 'succeeded'
+ succeeded = True
+ else:
+ values['result'] = 'failed'
+ succeeded = False
+ elif prog in [POST_ADD_REPO]:
+ if len(args) != 3:
+ parser.set_usage('Usage: %prog [options] category name principal')
+ parser.print_help()
+ return 3
+ values = { 'category' : args[0],
+ 'name' : args[1],
+ 'principal' : args[2],
+ 'default_instance' : 'new-repo',
+ 'default_subject' : 'New repository %(category)s/%(name)s'}
+ succeeded = True