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,23 +15,27 @@ LEADERLESS_URL = ('http://governance.openstack.org/resolutions/'
|
|||||||
|
|
||||||
time_frame = "%(start_str)s - %(end_str)s" % (conf['timeframe'])
|
time_frame = "%(start_str)s - %(end_str)s" % (conf['timeframe'])
|
||||||
start_release, _, end_release = conf['timeframe']['name'].partition('-')
|
start_release, _, end_release = conf['timeframe']['name'].partition('-')
|
||||||
tc_fmt_args = dict(
|
|
||||||
seats=conf['tc_seats'],
|
if conf['election_type'] == 'tc':
|
||||||
time_frame=time_frame,
|
tc_fmt_args = dict(
|
||||||
start_release=start_release,
|
seats=conf['tc_seats'],
|
||||||
end_release=end_release,
|
time_frame=time_frame,
|
||||||
last_release=end_release.lower(),
|
start_release=start_release,
|
||||||
start_nominations=utils.get_event('TC Nominations')['start_str'],
|
end_release=end_release,
|
||||||
end_nominations=utils.get_event('TC Nominations')['end_str'],
|
last_release=end_release.lower(),
|
||||||
campaign_start=utils.get_event('TC Campaigning')['start_str'],
|
start_nominations=utils.get_event('TC Nominations')['start_str'],
|
||||||
campaign_end=utils.get_event('TC Campaigning')['end_str'],
|
end_nominations=utils.get_event('TC Nominations')['end_str'],
|
||||||
election_start=utils.get_event('TC Elections')['start_str'],
|
campaign_start=utils.get_event('TC Campaigning')['start_str'],
|
||||||
election_end=utils.get_event('TC Elections')['end_str'],
|
campaign_end=utils.get_event('TC Campaigning')['end_str'],
|
||||||
poll_name='%s TC Election' % (conf['release'].capitalize()),
|
election_start=utils.get_event('TC Elections')['start_str'],
|
||||||
reference_url=REFERENCE_URL,
|
election_end=utils.get_event('TC Elections')['end_str'],
|
||||||
future_release=end_release.lower(),
|
poll_name='%s TC Election' % (conf['release'].capitalize()),
|
||||||
release=conf['release'],
|
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():
|
def ptl_election_season():
|
||||||
@ -453,14 +457,13 @@ Thank you,
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser('Tool to generate form emails')
|
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
|
# election_type
|
||||||
cmd_parsers = parser.add_subparsers(dest='election_type',
|
cmd_parsers = parser.add_subparsers(dest='election_type',
|
||||||
help=('Type of election. Choices '
|
help='Type of election.')
|
||||||
'tc'))
|
parser_ptl = cmd_parsers.add_parser('ptl')
|
||||||
# FIXME(tonyb): Do this after the TC election is over
|
parser_ptl.add_argument('template',
|
||||||
# parser_ptl = cmd_parsers.add_parser('ptl')
|
choices=['election_season'])
|
||||||
# parser_ptl.add_argument('template', choices=[])
|
|
||||||
parser_tc = cmd_parsers.add_parser('tc')
|
parser_tc = cmd_parsers.add_parser('tc')
|
||||||
parser_tc.add_argument('template',
|
parser_tc.add_argument('template',
|
||||||
choices=['election_season', 'nominations_kickoff',
|
choices=['election_season', 'nominations_kickoff',
|
||||||
@ -473,6 +476,11 @@ def main():
|
|||||||
parser.print_help(sys.stderr)
|
parser.print_help(sys.stderr)
|
||||||
sys.exit(1)
|
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__)
|
func_name = '%(election_type)s_%(template)s' % (args.__dict__)
|
||||||
if func_name in globals():
|
if func_name in globals():
|
||||||
func = globals()[func_name]
|
func = globals()[func_name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user