From 8be6722e8d901304f6795fcf97c02c0f45bca98e Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 20 Nov 2017 18:27:47 +0000 Subject: Require a "Ticket:" field for future proposals in certain states. New proposals in states {OPEN,ACCEPTED,CLOSED,FINISHED} must have a "Ticket:" field which may either be a ticket number or a publicly accessible URL. When the ticket is just a number, it should be in reference to Tor's canonical bug tracker. This information greatly helps both new contributors and relay operators who are interested in the implementation status of a working proposal. This patch permits the "Ticket:" field to be added to older proposals (<= prop#288), but it does not require it. --- proposals/reindex.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'proposals/reindex.py') diff --git a/proposals/reindex.py b/proposals/reindex.py index b442271..990016f 100755 --- a/proposals/reindex.py +++ b/proposals/reindex.py @@ -5,11 +5,11 @@ class Error(Exception): pass STATUSES = """DRAFT NEEDS-REVISION NEEDS-RESEARCH OPEN ACCEPTED META FINISHED CLOSED SUPERSEDED DEAD REJECTED OBSOLETE RESERVE INFORMATIONAL""".split() -REQUIRED_FIELDS = [ "Filename", "Status", "Title" ] -CONDITIONAL_FIELDS = { "OPEN" : [ "Target" ], - "ACCEPTED" : [ "Target "], - "CLOSED" : [ "Implemented-In" ], - "FINISHED" : [ "Implemented-In" ] } +REQUIRED_FIELDS = [ "Filename", "Status", "Title"] +CONDITIONAL_FIELDS = { "OPEN" : [ "Target", "Ticket" ], + "ACCEPTED" : [ "Target", "Ticket" ], + "CLOSED" : [ "Implemented-In", "Ticket" ], + "FINISHED" : [ "Implemented-In", "Ticket" ] } FNAME_RE = re.compile(r'^(\d\d\d)-.*[^\~]$') DIR = "." OUTFILE = "000-index.txt" @@ -45,9 +45,29 @@ def readProposal(fn): finally: f.close() +def getProposalNumber(fn): + """Get the proposal's assigned number from its filename `fn`.""" + parts = fn.split('-', 1) + + assert len(parts) == 2, \ + "Filename must have a proposal number and title separated by a '-'" + + return int(parts[0]) + def checkProposal(fn, fields): status = fields.get("Status") need_fields = REQUIRED_FIELDS + CONDITIONAL_FIELDS.get(status, []) + + number = getProposalNumber(fn) + # Since prop#288 was the newest when we began requiring the 'Ticket:' + # field, we don't require the field for it or any older proposal. + # (Although you're encouraged to add it to your proposal, and add it for + # older proposals where you know the correct ticket, as it greatly helps + # newcomers find more information on the implementation.) + if number <= 288: + if "Ticket" in need_fields: + need_fields.remove("Ticket") + for f in need_fields: if not fields.has_key(f): raise Error("%s has no %s field"%(fn, f)) -- cgit v1.2.3-54-g00ecf