Skip to content

Commit 9bcc4a9

Browse files
committed
Remove ballot.tsv view and comment out the ballot.json view in urls.py
- Legacy-Id: 5299
1 parent a8887c6 commit 9bcc4a9

3 files changed

Lines changed: 35 additions & 41 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -638,47 +638,44 @@ def ballot_for_popup(request, name):
638638
doc = get_object_or_404(Document, docalias__name=name)
639639
return HttpResponse(document_ballot_content(request, doc, ballot_id=None, editable=False))
640640

641-
def get_ballot(name):
642-
from ietf.doc.models import DocAlias
643-
alias = get_object_or_404(DocAlias, name=name)
644-
d = alias.document
645-
from ietf.idtracker.models import InternetDraft, BallotInfo
646-
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
647-
id = None
648-
bw = None
649-
dw = None
650-
if (d.type_id=='draft'):
651-
id = get_object_or_404(InternetDraft, name=d.name)
652-
try:
653-
if not id.ballot.ballot_issued:
654-
raise Http404
655-
except BallotInfo.DoesNotExist:
656-
raise Http404
657-
658-
bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
659-
# Python caches ~100 regex'es -- explicitly compiling it inside a method
660-
# (where you then throw away the compiled version!) doesn't make sense at
661-
# all.
662-
if re.search("^rfc([1-9][0-9]*)$", name):
663-
id.viewing_as_rfc = True
664-
dw = RfcWrapper(id)
665-
else:
666-
dw = IdWrapper(id)
667-
# XXX Fixme: Eliminate 'dw' as we go forward
668-
669-
try:
670-
b = d.latest_event(BallotDocEvent, type="created_ballot")
671-
except BallotDocEvent.DoesNotExist:
672-
raise Http404
673641

674-
return (bw, dw, b, d)
642+
def ballot_json(request, name):
643+
# REDESIGN: this view needs to be deleted or updated
644+
def get_ballot(name):
645+
from ietf.doc.models import DocAlias
646+
alias = get_object_or_404(DocAlias, name=name)
647+
d = alias.document
648+
from ietf.idtracker.models import InternetDraft, BallotInfo
649+
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
650+
id = None
651+
bw = None
652+
dw = None
653+
if (d.type_id=='draft'):
654+
id = get_object_or_404(InternetDraft, name=d.name)
655+
try:
656+
if not id.ballot.ballot_issued:
657+
raise Http404
658+
except BallotInfo.DoesNotExist:
659+
raise Http404
675660

661+
bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
662+
# Python caches ~100 regex'es -- explicitly compiling it inside a method
663+
# (where you then throw away the compiled version!) doesn't make sense at
664+
# all.
665+
if re.search("^rfc([1-9][0-9]*)$", name):
666+
id.viewing_as_rfc = True
667+
dw = RfcWrapper(id)
668+
else:
669+
dw = IdWrapper(id)
670+
# XXX Fixme: Eliminate 'dw' as we go forward
676671

677-
def ballot_tsv(request, name):
678-
ballot, doc, b, d = get_ballot(name)
679-
return HttpResponse(render_to_string('idrfc/ballot.tsv', {'ballot':ballot}, RequestContext(request)), content_type="text/plain")
672+
try:
673+
b = d.latest_event(BallotDocEvent, type="created_ballot")
674+
except BallotDocEvent.DoesNotExist:
675+
raise Http404
680676

681-
def ballot_json(request, name):
677+
return (bw, dw, b, d)
678+
682679
ballot, doc, b, d = get_ballot(name)
683680
response = HttpResponse(mimetype='text/plain')
684681
response.write(json.dumps(ballot.dict(), indent=2))

ietf/idrfc/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
url(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot/$', views_doc.document_ballot, name="doc_ballot"),
5353
(r'^(?P<name>[A-Za-z0-9._+-]+)/doc.json$', views_doc.document_json),
5454
(r'^(?P<name>[A-Za-z0-9._+-]+)/ballotpopup/$', views_doc.ballot_for_popup),
55-
(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot.tsv$', views_doc.ballot_tsv),
56-
(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot.json$', views_doc.ballot_json),
55+
#(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot.json$', views_doc.ballot_json), # legacy view
5756

5857
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/state/$', views_edit.change_state, name='doc_change_state'), # IESG state
5958
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/state/(?P<state_type>iana-action|iana-review)/$', views_edit.change_iana_state, name='doc_change_iana_state'),

ietf/templates/idrfc/ballot.tsv

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)