Remove the past_elections configuration
The original implementation of archived election results doesn't work well for publishing the result of the PTL round of the current election. Instead of relying on an (explicit) list of past elections, this change moves the archive to a results directory and render all the results present (implicit). Change-Id: Ia78988bced1cc07e2a44dde46b793f106857af94
This commit is contained in:
parent
1e6f4bceda
commit
d45c1f340b
@ -18,6 +18,3 @@ timeline:
|
||||
- name: 'PTL elections'
|
||||
start: '2017-02-01T23:59'
|
||||
end: '2017-02-07T23:45'
|
||||
|
||||
past_elections:
|
||||
- ocata
|
||||
|
@ -44,7 +44,8 @@ def render_list(list_type, candidates_list):
|
||||
|
||||
|
||||
def build_archive(serie, list_type):
|
||||
db_file = os.path.join(".", "doc", "source", serie, "%s.yaml" % list_type)
|
||||
db_file = os.path.join(".", "doc", "source",
|
||||
"results", serie, "%s.yaml" % list_type)
|
||||
if not os.path.isfile(db_file):
|
||||
return
|
||||
db = yaml.safe_load(open(db_file))
|
||||
@ -56,7 +57,8 @@ def build_archive(serie, list_type):
|
||||
db['tags']['TC-APPOINTED'] = True
|
||||
elif candidate['elected'] == 'INCUMBENT-PTL':
|
||||
db['tags']['INCUMBENT-PTL'] = True
|
||||
output = os.path.join(".", "doc", "source", serie, "%s.rst" % list_type)
|
||||
output = os.path.join(".", "doc", "source",
|
||||
"results", serie, "%s.rst" % list_type)
|
||||
template_name = "%s_archive.jinja" % list_type
|
||||
template_dir = os.path.join(".", "doc", "source", "_exts")
|
||||
with open(output, "wb") as out:
|
||||
@ -83,11 +85,12 @@ def build_lists(app):
|
||||
" :titlesonly:",
|
||||
""
|
||||
]
|
||||
for previous in utils.conf['past_elections']:
|
||||
archived_dir = os.path.join(".", "doc", "source", "results")
|
||||
for previous in os.listdir(archived_dir):
|
||||
if build_archive(previous, "ptl"):
|
||||
previous_toc.append(" %s/ptl.rst" % previous)
|
||||
previous_toc.append(" results/%s/ptl.rst" % previous)
|
||||
if build_archive(previous, "tc"):
|
||||
previous_toc.append(" %s/tc.rst" % previous)
|
||||
previous_toc.append(" results/%s/tc.rst" % previous)
|
||||
toc = os.path.join(".", "doc", "source", "archive_toc.rst")
|
||||
open(toc, "w").write("\n".join(previous_toc))
|
||||
|
||||
|
@ -83,7 +83,8 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
args.outputdir = os.path.join(args.basedir, 'doc', 'source', args.release)
|
||||
args.outputdir = os.path.join(args.basedir, 'doc', 'source',
|
||||
'results', args.release)
|
||||
args.outputdir = os.path.expanduser(args.outputdir)
|
||||
|
||||
if not os.path.isdir(args.outputdir):
|
||||
|
Loading…
x
Reference in New Issue
Block a user