Add first PTL template -- ptl_election_season
This slightly more complex than expected as we need to tie the template to the config so we don't try to get_event() for TC events and fail. This has been done in the least invasive way possible, we'll tidy things up at the end of the series Change-Id: Ib3c25072590507f347ee5ab3f3865eb4c991a34b
This commit is contained in:
parent
488c68a80c
commit
08cbef67fe
@ -15,7 +15,9 @@ LEADERLESS_URL = ('http://governance.openstack.org/resolutions/'
|
||||
|
||||
time_frame = "%(start_str)s - %(end_str)s" % (conf['timeframe'])
|
||||
start_release, _, end_release = conf['timeframe']['name'].partition('-')
|
||||
tc_fmt_args = dict(
|
||||
|
||||
if conf['election_type'] == 'tc':
|
||||
tc_fmt_args = dict(
|
||||
seats=conf['tc_seats'],
|
||||
time_frame=time_frame,
|
||||
start_release=start_release,
|
||||
@ -31,7 +33,9 @@ tc_fmt_args = dict(
|
||||
reference_url=REFERENCE_URL,
|
||||
future_release=end_release.lower(),
|
||||
release=conf['release'],
|
||||
)
|
||||
)
|
||||
elif conf['election_type'] == 'ptl':
|
||||
ptl_fmt_args = dict()
|
||||
|
||||
|
||||
def ptl_election_season():
|
||||
@ -453,14 +457,13 @@ Thank you,
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser('Tool to generate form emails')
|
||||
# Use a sub parser so we can have diffent template choices based on the
|
||||
# Use a sub parser so we can have different template choices based on the
|
||||
# election_type
|
||||
cmd_parsers = parser.add_subparsers(dest='election_type',
|
||||
help=('Type of election. Choices '
|
||||
'tc'))
|
||||
# FIXME(tonyb): Do this after the TC election is over
|
||||
# parser_ptl = cmd_parsers.add_parser('ptl')
|
||||
# parser_ptl.add_argument('template', choices=[])
|
||||
help='Type of election.')
|
||||
parser_ptl = cmd_parsers.add_parser('ptl')
|
||||
parser_ptl.add_argument('template',
|
||||
choices=['election_season'])
|
||||
parser_tc = cmd_parsers.add_parser('tc')
|
||||
parser_tc.add_argument('template',
|
||||
choices=['election_season', 'nominations_kickoff',
|
||||
@ -473,6 +476,11 @@ def main():
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if args.election_type != conf['election_type']:
|
||||
print('Requested %s but repo is currently configured for %s' %
|
||||
(args.election_type, conf['election_type']))
|
||||
sys.exit(1)
|
||||
|
||||
func_name = '%(election_type)s_%(template)s' % (args.__dict__)
|
||||
if func_name in globals():
|
||||
func = globals()[func_name]
|
||||
|
Loading…
x
Reference in New Issue
Block a user