diff --git a/ietf/idrfc/views_doc.py b/ietf/idrfc/views_doc.py index f9ee5e0e2..75389f89d 100644 --- a/ietf/idrfc/views_doc.py +++ b/ietf/idrfc/views_doc.py @@ -544,55 +544,46 @@ def _get_versions(draft, include_replaced=True): return ov def get_ballot(name): - r = re.compile("^rfc([1-9][0-9]*)$") - m = r.match(name) - - if settings.USE_DB_REDESIGN_PROXY_CLASSES: - from ietf.doc.models import DocAlias - alias = get_object_or_404(DocAlias, name=name) - d = get_object_or_404(InternetDraft, name=alias.document.name) - try: - if not d.ballot.ballot_issued: - raise Http404 - except BallotInfo.DoesNotExist: - raise Http404 - - bw = BallotWrapper(d) - if m: - d.viewing_as_rfc = True - dw = RfcWrapper(d) - else: - dw = IdWrapper(d) - - return (bw, dw) - - if m: - rfc_number = int(m.group(1)) - rfci = get_object_or_404(RfcIndex, rfc_number=rfc_number) - id = get_object_or_404(IDInternal, rfc_flag=1, draft=rfc_number) - doc = RfcWrapper(rfci, idinternal=id) - else: - id = get_object_or_404(IDInternal, rfc_flag=0, draft__filename=name) - doc = IdWrapper(id) + from ietf.doc.models import DocAlias + alias = get_object_or_404(DocAlias, name=name) + d = alias.document + id = get_object_or_404(InternetDraft, name=d.name) try: if not id.ballot.ballot_issued: raise Http404 except BallotInfo.DoesNotExist: raise Http404 - ballot = BallotWrapper(id) - return ballot, doc + try: + b = d.latest_event(BallotDocEvent, type="created_ballot") + except BallotDocEvent.DoesNotExist: + raise Http404 + + bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward + + # Python caches ~100 regex'es -- explicitly compiling it inside a method + # (where you then throw away the compiled version!) doesn't make sense at + # all. + if re.search("^rfc([1-9][0-9]*)$", name): + id.viewing_as_rfc = True + dw = RfcWrapper(id) + else: + dw = IdWrapper(id) + # XXX Fixme: Eliminate 'dw' as we go forward + + + return (bw, dw, b, d) def ballot_html(request, name): - ballot, doc = get_ballot(name) - return render_to_response('idrfc/doc_ballot.html', {'ballot':ballot, 'doc':doc}, context_instance=RequestContext(request)) + bw, dw, ballot, doc = get_ballot(name) + return render_to_response('idrfc/doc_ballot.html', {'bw':bw, 'dw':dw, 'ballot':ballot, 'doc':doc}, context_instance=RequestContext(request)) def ballot_tsv(request, name): - ballot, doc = get_ballot(name) + ballot, doc, b, d = get_ballot(name) return HttpResponse(render_to_string('idrfc/ballot.tsv', {'ballot':ballot}, RequestContext(request)), content_type="text/plain") def ballot_json(request, name): - ballot, doc = get_ballot(name) + ballot, doc, b, d = get_ballot(name) response = HttpResponse(mimetype='text/plain') response.write(json.dumps(ballot.dict(), indent=2)) return response diff --git a/ietf/templates/idrfc/doc_ballot.html b/ietf/templates/idrfc/doc_ballot.html index 9a985088f..225afcd0c 100644 --- a/ietf/templates/idrfc/doc_ballot.html +++ b/ietf/templates/idrfc/doc_ballot.html @@ -36,52 +36,52 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %} {% if user|in_group:"Area_Director" %} -
Discuss
-{% with ballot.get_discuss as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
Yes
-{% with ballot.get_yes as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
No Objection
-{% with ballot.get_no_objection as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
Abstain
-{% with ballot.get_abstain as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
Recuse
-{% with ballot.get_recuse as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
No Record
-{% with ballot.get_no_record as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}
Other documents in this ballot set: {% for x in ballot.ballot_set_other%}{{x|urlize_ietf_docs}}{% if not forloop.last %}, {% endif %}{% endfor %}
{% endif %} +{% if bw.is_ballot_set %}Other documents in this ballot set: {% for x in bw.ballot_set_other%}{{x|urlize_ietf_docs}}{% if not forloop.last %}, {% endif %}{% endfor %}
{% endif %} -{% if doc.in_ietf_process and doc.ietf_process.has_active_iesg_ballot %} -Summary: {{ doc.ietf_process.iesg_ballot_needed }}
+{% if dw.in_ietf_process and dw.ietf_process.has_active_iesg_ballot %} +Summary: {{ dw.ietf_process.iesg_ballot_needed }}
{% endif %} -{% for pos in ballot.get_texts|dictsort:"is_old_ad" %} +{% for pos in bw.get_texts|dictsort:"is_old_ad" %}