diff options
author | Isis Lovecruft <isis@torproject.org> | 2017-11-20 18:27:47 +0000 |
---|---|---|
committer | Isis Lovecruft <isis@torproject.org> | 2017-12-08 01:53:52 +0000 |
commit | 8be6722e8d901304f6795fcf97c02c0f45bca98e (patch) | |
tree | 3217331d152cb65cb93848eeea5b40527ab0e251 /proposals/reindex.py | |
parent | c78806e96eed6828873c6f9604f2a89d14fc123d (diff) | |
download | torspec-8be6722e8d901304f6795fcf97c02c0f45bca98e.tar.gz torspec-8be6722e8d901304f6795fcf97c02c0f45bca98e.zip |
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.
Diffstat (limited to 'proposals/reindex.py')
-rwxr-xr-x | proposals/reindex.py | 30 |
1 files changed, 25 insertions, 5 deletions
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)) |