@@ -569,36 +569,39 @@ def get_ballot(name):
569569 from ietf .doc .models import DocAlias
570570 alias = get_object_or_404 (DocAlias , name = name )
571571 d = alias .document
572- id = get_object_or_404 (InternetDraft , name = d .name )
573- try :
574- if not id .ballot .ballot_issued :
572+ id = None
573+ bw = None
574+ dw = None
575+ if (d .type_id == 'draft' ):
576+ id = get_object_or_404 (InternetDraft , name = d .name )
577+ try :
578+ if not id .ballot .ballot_issued :
579+ raise Http404
580+ except BallotInfo .DoesNotExist :
575581 raise Http404
576- except BallotInfo .DoesNotExist :
577- raise Http404
582+
583+ bw = BallotWrapper (id ) # XXX Fixme: Eliminate this as we go forward
584+ # Python caches ~100 regex'es -- explicitly compiling it inside a method
585+ # (where you then throw away the compiled version!) doesn't make sense at
586+ # all.
587+ if re .search ("^rfc([1-9][0-9]*)$" , name ):
588+ id .viewing_as_rfc = True
589+ dw = RfcWrapper (id )
590+ else :
591+ dw = IdWrapper (id )
592+ # XXX Fixme: Eliminate 'dw' as we go forward
578593
579594 try :
580595 b = d .latest_event (BallotDocEvent , type = "created_ballot" )
581596 except BallotDocEvent .DoesNotExist :
582597 raise Http404
583598
584- bw = BallotWrapper (id ) # XXX Fixme: Eliminate this as we go forward
585-
586- # Python caches ~100 regex'es -- explicitly compiling it inside a method
587- # (where you then throw away the compiled version!) doesn't make sense at
588- # all.
589- if re .search ("^rfc([1-9][0-9]*)$" , name ):
590- id .viewing_as_rfc = True
591- dw = RfcWrapper (id )
592- else :
593- dw = IdWrapper (id )
594- # XXX Fixme: Eliminate 'dw' as we go forward
595-
596-
597599 return (bw , dw , b , d )
598600
599601def ballot_html (request , name ):
600602 bw , dw , ballot , doc = get_ballot (name )
601- return render_to_response ('idrfc/doc_ballot.html' , {'bw' :bw , 'dw' :dw , 'ballot' :ballot , 'doc' :doc }, context_instance = RequestContext (request ))
603+ content = document_ballot_content (request , doc , ballot .pk , editable = True )
604+ return HttpResponse (content )
602605
603606def ballot_tsv (request , name ):
604607 ballot , doc , b , d = get_ballot (name )
0 commit comments