Skip to content

Commit 8313b0a

Browse files
committed
Fixes for questions for you. Does not include any changes in docker/
- Legacy-Id: 17150
1 parent bb7e504 commit 8313b0a

4 files changed

Lines changed: 7 additions & 60 deletions

File tree

ietf/doc/tests_irsg_ballot.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,10 @@ def test_issue_ballot(self):
180180
# Press the No button - expect nothing but a redirect back to the draft's main page
181181
r = self.client.post(url,dict(irsg_button="No"))
182182
self.assertEqual(r.status_code, 302)
183-
# PEY: Insert assertion about the redirect URL
184183

185184
# Press the Yes button
186185
r = self.client.post(url,dict(irsg_button="Yes", duedate="2038-01-19"))
187186
self.assertEqual(r.status_code, 302)
188-
# PEY: Check on whether the ballot is reflected in the BallotDocEvents table
189-
# Can't get ballot_type to work in the filter below, so commented out for now
190-
# ballot_type = BallotType.objects.get(doc_type=rg_draft.type,slug='irsg-approve')
191-
# debug.show("ballot_type")
192187
ballot_created = list(BallotDocEvent.objects.filter(doc=rg_draft1,
193188
type="created_ballot"))
194189
self.assertNotEqual(len(ballot_created), 0)
@@ -392,12 +387,9 @@ def test_close_ballot(self):
392387

393388
def test_view_outstanding_ballots(self):
394389
draft = RgDraftFactory()
395-
# PEY: Commented out RJS' following line., Will need this in the future when irsg_ballot_status changes to take a ballot not a doc
396-
# ballot = IRSGBallotDocEventFactory(doc=draft)
397390
IRSGBallotDocEventFactory(doc=draft)
398391
url = urlreverse('ietf.doc.views_ballot.irsg_ballot_status')
399392

400-
login_testing_unauthorized(self, self.username, url)
401393
r = self.client.get(url)
402394
self.assertEqual(r.status_code, 200)
403395
self.assertIn(draft.name, unicontent(r))
@@ -439,8 +431,6 @@ def test_cant_issue_irsg_ballot(self):
439431

440432
def test_cant_close_irsg_ballot(self):
441433
draft = RgDraftFactory()
442-
# PEY: Commented out RJS' following line. Will need this in the future when close_irsg_ballot changes to taking a ballot not a doc
443-
# ballot = IRSGBallotDocEventFactory(doc=draft)
444434
IRSGBallotDocEventFactory(doc=draft)
445435
url = urlreverse('ietf.doc.views_ballot.close_irsg_ballot', kwargs=dict(name=draft.name))
446436

ietf/doc/views_ballot.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ def edit_position(request, name, ballot_id):
213213

214214
if request.method == 'POST':
215215
old_pos = None
216-
# PEY: if not has_role(request.user, "Secretariat") and not pos_by.role_set.filter(name="ad", group__type="area", group__state="active"):
217216
if not has_role(request.user, "Secretariat") and not can_ballot(request.user, doc):
218217
# prevent pre-ADs from voting
219218
return HttpResponseForbidden("Must be a proper Area Director in an active area or IRSG Member to cast ballot")
@@ -327,7 +326,6 @@ def build_position_email(pos_by, doc, pos):
327326
pos=pos.pos,
328327
blocking_name=blocking_name,
329328
settings=settings))
330-
# PEY: This doesn't work properly for IRSG members, since they don't have the "ad" role. It still manages to get an address so it doesn't have to be fixed as a first priority.
331329
frm = pos_by.role_email("ad").formatted_email()
332330

333331
if doc.stream_id == "irtf":
@@ -1090,13 +1088,11 @@ def issue_irsg_ballot(request, name):
10901088
if (duedate == None or duedate==""):
10911089
duedate = str(fillerdate)
10921090
e.duedate = datetime.datetime.strptime(duedate, '%Y-%m-%d')
1093-
# PEY: What's the best thing to do for "unreasonable" dates?
10941091
e.type = "created_ballot"
10951092
e.desc = "Created IRSG Ballot"
10961093
ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
10971094
e.ballot_type = ballot_type
10981095
e.save()
1099-
# PEY: This is probably not enough state setting/cleanup. I should review the IESG version more to see what happens.
11001096
new_state = doc.get_state()
11011097
prev_tags = []
11021098
new_tags = []
@@ -1121,7 +1117,7 @@ def issue_irsg_ballot(request, name):
11211117
else:
11221118
templ = 'doc/ballot/irsg_ballot_approve.html'
11231119

1124-
question = "Are you sure you really want to issue a ballot for " + name + "?"
1120+
question = "Confirm issuing a ballot for " + name + "?"
11251121
return render(request, templ, dict(doc=doc,
11261122
question=question, fillerdate=fillerdate))
11271123

@@ -1136,43 +1132,16 @@ def close_irsg_ballot(request, name):
11361132
if request.method == 'POST':
11371133
button = request.POST.__getitem__("irsg_button")
11381134
if button == 'Yes':
1139-
e = BallotDocEvent(doc=doc, rev=doc.rev, by=request.user.person)
1140-
e.type = "closed_ballot"
1141-
e.desc = "Closed IRSG Ballot"
1142-
ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
1143-
e.ballot_type = ballot_type
1144-
e.save()
1145-
# PEY: This is probably not enough state setting/cleanup. I should review the IESG version more to see what happens.
1146-
new_state = doc.get_state()
1147-
prev_tags = []
1148-
new_tags = []
1149-
1150-
# PEY: Need to determine what the correct state to transition to is.
1151-
if doc.type_id == 'draft':
1152-
new_state = State.objects.get(used=True, type="draft-stream-irtf", slug='active')
1153-
1154-
prev_state = doc.get_state(new_state.type_id if new_state else None)
1155-
1156-
doc.set_state(new_state)
1157-
doc.tags.remove(*prev_tags)
1158-
1159-
events = []
1160-
state_change_event = add_state_change_event(doc, by, prev_state, new_state, prev_tags=prev_tags, new_tags=new_tags)
1161-
if state_change_event:
1162-
events.append(state_change_event)
1163-
1164-
if events:
1165-
doc.save_with_history(events)
1135+
close_ballot(doc, by, "irsg-approve")
11661136

11671137
return HttpResponseRedirect(doc.get_absolute_url())
11681138

11691139
templ = 'doc/ballot/irsg_ballot_close.html'
11701140

1171-
question = "Are you sure you really want to close the ballot for " + name + "?"
1141+
question = "Confirm closing the ballot for " + name + "?"
11721142
return render(request, templ, dict(doc=doc,
11731143
question=question))
11741144

1175-
@role_required('Secretariat', 'IRTF Chair')
11761145
def irsg_ballot_status(request):
11771146
possible_docs = Document.objects.filter(docevent__ballotdocevent__irsgballotdocevent__isnull=False)
11781147
docs = []
@@ -1181,7 +1150,6 @@ def irsg_ballot_status(request):
11811150
ballot = doc.active_ballot()
11821151
if ballot:
11831152
doc.ballot = ballot
1184-
# PEY: Need to figure how to work the duedate into status_columns.html
11851153
# PEY: Also, how is it I can add duedate to doc just like that?
11861154
doc.duedate=datetime.datetime.strftime(ballot.irsgballotdocevent.duedate, '%Y-%m-%d')
11871155

ietf/doc/views_doc.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@
8383

8484

8585
def render_document_top(request, doc, tab, name):
86-
# PEY: Figuring out what tab value is
8786
tabs = []
8887
tabs.append(("Status", "status", urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=name)), True, None))
8988

90-
# ballot = doc.latest_event(BallotDocEvent, type="created_ballot")
91-
# ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
9289
iesg_ballot = doc.latest_event(BallotDocEvent, type="created_ballot", ballot_type__slug='approve')
9390
irsg_ballot = doc.latest_event(BallotDocEvent, type="created_ballot",ballot_type__slug='irsg-approve')
9491

@@ -504,7 +501,6 @@ def document_main(request, name, rev=None):
504501

505502
ballot_summary = None
506503
if doc.get_state_slug() in ("intrev", "iesgrev"):
507-
# PEY: Need to adjust this so that I check draft-stream-irtf state as well and generate an irsg_ballot_summary as needed...
508504
active_ballot = doc.active_ballot()
509505
if active_ballot:
510506
ballot_summary = needed_ballot_positions(doc, list(active_ballot.active_balloteer_positions().values()))
@@ -548,7 +544,6 @@ def document_main(request, name, rev=None):
548544
content = markup_txt.markup(content)
549545

550546
ballot_summary = None
551-
# PEY: Need to work in irsg_ballot_summary here as well
552547
if doc.get_state_slug() in ("iesgeval") and doc.active_ballot():
553548
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_balloteer_positions().values()))
554549

@@ -576,7 +571,6 @@ def document_main(request, name, rev=None):
576571
content = doc.text_or_error() # pyflakes:ignore
577572

578573
ballot_summary = None
579-
# PEY: work in irsg_ballot_summary here too
580574
if doc.get_state_slug() in ("iesgeval"):
581575
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_balloteer_positions().values()))
582576

@@ -1032,7 +1026,6 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
10321026
else:
10331027
position_groups.append(g)
10341028

1035-
# PEY: Need to integrate irsg_needed_ballot_positions here as well.
10361029
if (ballot.ballot_type.slug == "irsg-approve"):
10371030
summary = irsg_needed_ballot_positions(doc, [p for p in positions if not p.old_pos_by])
10381031
else:
@@ -1068,8 +1061,7 @@ def document_ballot(request, name, ballot_id=None):
10681061
if all_ballots:
10691062
ballot = all_ballots[-1]
10701063
else:
1071-
# PEY: What should I do if I somehow got here without any ballots existing? Can that happen? Passing for now.
1072-
pass
1064+
raise Http404("Ballot not found for: %s" % name)
10731065
ballot_id = ballot.id
10741066
else:
10751067
ballot_id = int(ballot_id)
@@ -1079,8 +1071,7 @@ def document_ballot(request, name, ballot_id=None):
10791071
break
10801072

10811073
if not ballot_id or not ballot:
1082-
# PEY: Something bad happened. How do I gracefully bail out?
1083-
pass
1074+
raise Http404("Ballot not found for: %s" % name)
10841075

10851076
if ballot.ballot_type.slug == "approve":
10861077
ballot_tab = "ballot"

ietf/templates/base/menu.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@
5555
<li><a href="{% url 'ietf.doc.views_status_change.rfc_status_changes' %}">RFC status changes</a></li>
5656
{% endif %}
5757

58-
{% if user|has_role:"IRTF Chair,Secretariat" %}
59-
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}
60-
<li><a href="{% url 'ietf.doc.views_ballot.irsg_ballot_status' %}">IRSG ballot status</a></li>
61-
{% endif %}
58+
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}
59+
<li><a href="{% url 'ietf.doc.views_ballot.irsg_ballot_status' %}">IRSG ballot status</a></li>
6260

6361
{% if user|has_role:"WG Chair,RG Chair" %}
6462
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}

0 commit comments

Comments
 (0)