Skip to content

Commit 4127a44

Browse files
committed
View for editing ballot position, so far only with voting support
- Legacy-Id: 2275
1 parent 10d8ddd commit 4127a44

9 files changed

Lines changed: 266 additions & 14 deletions

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<django-objects version="1.0">
3+
<object pk="3175" model="idtracker.ballotinfo">
4+
<field type="BooleanField" name="active">1</field>
5+
<field type="BooleanField" name="an_sent">0</field>
6+
<field type="DateField" name="an_sent_date"><None></None></field>
7+
<field to="idtracker.iesglogin" name="an_sent_by" rel="ManyToOneRel"><None></None></field>
8+
<field type="BooleanField" name="defer">0</field>
9+
<field to="idtracker.iesglogin" name="defer_by" rel="ManyToOneRel">111</field>
10+
<field type="DateField" name="defer_date">2009-10-06</field>
11+
<field type="TextField" name="approval_text">From: The IESG &lt;iesg-secretary@ietf.org&gt;
12+
To: IETF-Announce &lt;ietf-announce@ietf.org&gt;
13+
Cc: Internet Architecture Board &lt;iab@iab.org&gt;,
14+
RFC Editor &lt;rfc-editor@rfc-editor.org&gt;,
15+
mipshop mailing list &lt;mipshop@ietf.org&gt;,
16+
mipshop chair &lt;mipshop-chairs@tools.ietf.org&gt;
17+
Subject: Protocol Action: 'Fast Handovers for Proxy Mobile IPv6' to
18+
Proposed Standard
19+
20+
The IESG has approved the following document:
21+
22+
- 'Fast Handovers for Proxy Mobile IPv6 '
23+
&lt;draft-ietf-mipshop-pfmipv6-09.txt&gt; as a Proposed Standard
24+
25+
26+
This document is the product of the Mobility for IP: Performance,
27+
Signaling and Handoff Optimization Working Group.
28+
29+
The IESG contact persons are Jari Arkko and Ralph Droms.
30+
31+
A URL of this Internet-Draft is:
32+
http://www.ietf.org/internet-drafts/draft-ietf-mipshop-pfmipv6-09.txt</field>
33+
<field type="TextField" name="last_call_text">To: IETF-Announce &lt;ietf-announce@ietf.org&gt;
34+
From: The IESG &lt;iesg-secretary@ietf.org&gt;
35+
Reply-to: ietf@ietf.org
36+
CC: &lt;mipshop@ietf.org&gt;
37+
Subject: Last Call: draft-ietf-mipshop-pfmipv6 (Fast Handovers for Proxy Mobile IPv6) to Proposed Standard
38+
39+
The IESG has received a request from the Mobility for IP: Performance,
40+
Signaling and Handoff Optimization WG (mipshop) to consider the following document:
41+
42+
- 'Fast Handovers for Proxy Mobile IPv6 '
43+
&lt;draft-ietf-mipshop-pfmipv6-09.txt&gt; as a Proposed Standard
44+
45+
The IESG plans to make a decision in the next few weeks, and solicits
46+
final comments on this action. Please send substantive comments to the
47+
ietf@ietf.org mailing lists by 2009-09-22. Exceptionally,
48+
comments may be sent to iesg@ietf.org instead. In either case, please
49+
retain the beginning of the Subject line to allow automated sorting.
50+
51+
The file can be obtained via
52+
http://www.ietf.org/internet-drafts/draft-ietf-mipshop-pfmipv6-09.txt
53+
54+
55+
IESG discussion can be tracked via
56+
https://datatracker.ietf.org/public/pidtracker.cgi?command=view_id&amp;dTag=17914&amp;rfc_flag=0</field>
57+
<field type="TextField" name="ballot_writeup">Technical Summary
58+
59+
The document describes a mechanism to provide fast handovers when
60+
Proxy Mobile IPv6 is used as the mobility management protocol. It
61+
also describes a mechanism to transfer context between two MAGs
62+
to assist in the handover. The mobile node is not involved in any
63+
Signaling for the fast handovers to work.
64+
65+
Working Group Summary
66+
67+
This is a product of the MIPSHOP WG.
68+
69+
Document Quality
70+
71+
There are no known implementations of the specification. It is likely
72+
to be implemented by some vendors, since this document is required
73+
for fast handovers in 3GPP2 eHPRD network.
74+
75+
Personnel
76+
77+
Document shepherd: Vijay Devarapalli
78+
Responsible AD: Jari Arkko
79+
80+
RFC Editor Note
81+
82+
(Insert RFC Editor Note here or remove section)
83+
84+
IRTF Note
85+
86+
(Insert IRTF Note here or remove section)
87+
88+
IESG Note
89+
90+
(Insert IESG Note here or remove section)
91+
92+
IANA Note
93+
94+
(Insert IANA Note here or remove section)</field>
95+
<field type="IntegerField" name="ballot_issued">1</field>
96+
</object>
97+
</django-objects>

branch/iesg-tracker/ietf/idrfc/generate_fixtures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def output(name, qs):
4949
output("base", base)
5050

5151

52-
# specific draft
52+
# specific drafts
5353
draftdata = []
5454
d = InternetDraft.objects.get(filename="draft-ietf-mipshop-pfmipv6")
5555
draftdata.extend([d, d.idinternal, d.group, d.group.ietfwg])
@@ -60,3 +60,7 @@ def output(name, qs):
6060
d = InternetDraft.objects.get(filename="draft-ietf-mip6-cn-ipsec")
6161
draftdata.extend([d, d.idinternal])
6262
output("draft", draftdata)
63+
64+
# specific ballot info
65+
d = InternetDraft.objects.get(filename="draft-ietf-mipshop-pfmipv6")
66+
output("ballot", [d.idinternal.ballot])

branch/iesg-tracker/ietf/idrfc/tests.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class AddCommentTestCase(django.test.TestCase):
223223
fixtures = ['base', 'draft']
224224

225225
def test_add_comment(self):
226-
draft = InternetDraft.objects.get(filename="draft-ietf-mip6-cn-ipsec")
226+
draft = InternetDraft.objects.get(filename="draft-ietf-mipshop-pfmipv6")
227227
url = urlreverse('doc_add_comment', kwargs=dict(name=draft.filename))
228228
login_testing_unauthorized(self, "klm", url)
229229

@@ -244,6 +244,55 @@ def test_add_comment(self):
244244
self.assertTrue(len(mail_outbox) == 1)
245245
self.assertTrue("updated" in mail_outbox[0]['Subject'])
246246
self.assertTrue(draft.filename in mail_outbox[0]['Subject'])
247+
248+
class EditPositionTestCase(django.test.TestCase):
249+
fixtures = ['base', 'draft', 'ballot']
250+
251+
def test_edit_position(self):
252+
draft = InternetDraft.objects.get(filename="draft-ietf-mipshop-pfmipv6")
253+
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.filename))
254+
login_testing_unauthorized(self, "rhousley", url)
255+
256+
# normal get
257+
r = self.client.get(url)
258+
self.assertEquals(r.status_code, 200)
259+
q = PyQuery(r.content)
260+
self.assertTrue(len(q('form input[name=position]')) > 0)
261+
self.assertEquals(len(q('form textarea[name=comment_text]')), 1)
262+
263+
# vote
264+
comments_before = draft.idinternal.comments().count()
265+
self.assertTrue(not Position.objects.filter(ballot=draft.idinternal.ballot, ad__login_name="rhousley"))
266+
267+
r = self.client.post(url, dict(position="discuss",
268+
discuss="This is a discussion test.",
269+
comment="This is a test."))
270+
self.assertEquals(r.status_code, 302)
271+
272+
pos = Position.objects.filter(ballot=draft.idinternal.ballot, ad__login_name="rhousley")[0]
273+
#self.assertTrue("This is a discussion test." in pos.discuss) FIXME
274+
#self.assertTrue("This is a test." in pos.comment)
275+
self.assertTrue(pos.discuss)
276+
self.assertTrue(not (pos.yes or pos.noobj or pos.abstain or pos.recuse))
277+
278+
self.assertEquals(draft.idinternal.comments().count(), comments_before + 1)
279+
self.assertTrue("New position" in draft.idinternal.comments()[0].comment_text)
280+
281+
# recast vote
282+
comments_before = draft.idinternal.comments().count()
283+
r = self.client.post(url, dict(position="noobj"))
284+
self.assertEquals(r.status_code, 302)
285+
286+
pos = Position.objects.filter(ballot=draft.idinternal.ballot, ad__login_name="rhousley")[0]
287+
self.assertTrue(pos.noobj)
288+
self.assertTrue(not (pos.yes or pos.abstain or pos.recuse))
289+
self.assertTrue(pos.discuss == -1)
290+
self.assertEquals(draft.idinternal.comments().count(), comments_before + 1)
291+
self.assertTrue("Position" in draft.idinternal.comments()[0].comment_text)
292+
293+
#self.assertTrue(len(mail_outbox) == 1)
294+
#self.assertTrue("updated" in mail_outbox[0]['Subject'])
295+
#self.assertTrue(draft.filename in mail_outbox[0]['Subject'])
247296

248297

249298
TEST_RFC_INDEX = '''<?xml version="1.0" encoding="UTF-8"?>

branch/iesg-tracker/ietf/idrfc/urls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
(r'^(?P<name>[^/]+)/_debug.data$', views_doc.document_debug),
4343
(r'^(?P<name>[^/]+)/_ballot.data$', views_doc.document_ballot),
4444
(r'^ad/(?P<name>[^/]+)/$', views_search.by_ad),
45+
4546
url(r'^(?P<name>[^/]+)/edit/state/$', views_edit.change_state, {}, name='doc_change_state'),
4647
url(r'^(?P<name>[^/]+)/edit/info/$', views_edit.edit_info, {}, name='doc_edit_info'),
4748
url(r'^(?P<name>[^/]+)/edit/resurrect/$', views_edit.request_resurrect, {}, name='doc_request_resurrect'),
48-
url(r'^(?P<name>[^/]+)/edit/addcomment/$', views_edit.add_comment, {}, name='doc_add_comment'),
49+
url(r'^(?P<name>[^/]+)/edit/addcomment/$', views_edit.add_comment, {}, name='doc_add_comment'),
50+
url(r'^(?P<name>[^/]+)/edit/position/$', views_edit.edit_position, {}, name='doc_edit_position'),
4951
)

branch/iesg-tracker/ietf/idrfc/views_edit.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,80 @@ def add_comment(request, name):
337337
dict(doc=doc,
338338
form=form),
339339
context_instance=RequestContext(request))
340+
341+
BALLOT_CHOICES = (("yes", "Yes"),
342+
("noobj", "No Objection"),
343+
("discuss", "Discuss"),
344+
("abstain", "Abstain"),
345+
("recuse", "Recuse"),
346+
("", "No Record"),
347+
)
348+
349+
def position_to_ballot_choice(position):
350+
for v, label in BALLOT_CHOICES:
351+
if v and getattr(position, v):
352+
return v
353+
return ""
354+
355+
def position_label(position_value):
356+
return dict(BALLOT_CHOICES).get(position_value, "")
357+
358+
class EditPositionForm(forms.Form):
359+
position = forms.ChoiceField(choices=BALLOT_CHOICES, widget=forms.RadioSelect)
360+
discuss_text = forms.CharField(required=False, widget=forms.Textarea)
361+
comment_text = forms.CharField(required=False, widget=forms.Textarea)
362+
363+
@group_required('Area_Director','Secretariat')
364+
def edit_position(request, name):
365+
doc = get_object_or_404(InternetDraft, filename=name)
366+
if not doc.idinternal:
367+
raise Http404()
368+
369+
login = IESGLogin.objects.get(login_name=request.user.username)
370+
371+
if request.method == 'POST':
372+
form = EditPositionForm(request.POST)
373+
if form.is_valid():
374+
vote = form.cleaned_data['position']
375+
try:
376+
pos = Position.objects.get(ballot=doc.idinternal.ballot, ad=login)
377+
# mark discuss as cleared (quirk from old system)
378+
if pos.discuss:
379+
pos.discuss = -1
380+
except Position.DoesNotExist:
381+
pos = Position(ballot=doc.idinternal.ballot, ad=login)
382+
pos.discuss = 0
383+
384+
old_vote = position_to_ballot_choice(pos)
385+
386+
pos.yes = pos.noobj = pos.abstain = pos.recuse = 0
387+
if vote:
388+
setattr(pos, vote, 1)
389+
390+
if pos.id:
391+
pos.save()
392+
add_document_comment(request, doc, "[Ballot Position Update] Position for %s has been changed to %s from %s" % (pos.ad, position_label(vote), position_label(old_vote)))
393+
elif vote:
394+
pos.save()
395+
add_document_comment(request, doc, "[Ballot Position Update] New position, %s, has been recorded" % position_label(vote))
396+
397+
IESGDiscuss.objects.filter(ballot=doc.idinternal.ballot, ad=pos.ad).update(active=False)
398+
399+
# FIXME: discuss and comments
400+
401+
#email_owner(request, doc, doc.idinternal.job_owner, login, "A new comment added by %s" % login)
402+
doc.idinternal.event_date = date.today()
403+
doc.idinternal.save()
404+
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
405+
else:
406+
initial = {}
407+
pos = Position.objects.filter(ballot=doc.idinternal.ballot, ad=login)
408+
if pos:
409+
initial['position'] = position_to_ballot_choice(pos[0])
410+
411+
form = EditPositionForm(initial=initial)
412+
413+
return render_to_response('idrfc/edit_position.html',
414+
dict(doc=doc,
415+
form=form),
416+
context_instance=RequestContext(request))

branch/iesg-tracker/ietf/idtracker/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ class Position(models.Model):
679679
yes = models.IntegerField(db_column='yes_col')
680680
noobj = models.IntegerField(db_column='no_col')
681681
abstain = models.IntegerField()
682-
approve = models.IntegerField()
682+
approve = models.IntegerField(default=0) # doesn't appear to be used anymore?
683683
discuss = models.IntegerField()
684684
recuse = models.IntegerField()
685685
def __str__(self):

branch/iesg-tracker/ietf/templates/idrfc/add_comment.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<form action="" method="POST">
2-
<table>
3-
{{ form.as_table }}
4-
</table>
2+
{{ form.comment }}
53

64
<div class="actions">
75
<a href="{{ doc.idinternal.get_absolute_url }}">Back</a>

branch/iesg-tracker/ietf/templates/idrfc/doc_ballot.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@
3434
{% load ietf_filters %}
3535
<table class="ietf-ballot"><tr valign="top"><td class="left">
3636

37-
{% if doc_ballot_edit_button %}
38-
{% if user|in_group:"Area_Director,Secretariat" %}
39-
<div style="margin-top:8px; margin-bottom:8px;">
40-
<span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child">
41-
<a href="https://datatracker.ietf.org/cgi-bin/idtracker.cgi?command=open_ballot&amp;id_document_tag={% if info.is_rfc %}{{doc.rfc_number}}{% else %}{{doc.tracker_id}}{% endif %}">Edit position</a>
42-
</span></span></div>
43-
{% endif %}{# user in_group #}
37+
{% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %}
38+
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_edit_position name=doc.draft_name %}">Edit position</a></span></span></div>
4439
{% endif %}
4540

4641
<p style="margin-top:1em;"><span class="square" style="background:#c00000;"></span><b>Discuss</b><br/>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<style>
2+
form.position-form .position ul {
3+
padding: 0;
4+
margin: 0;
5+
}
6+
form.position-form .position li {
7+
list-style-type: none;
8+
float: left;
9+
padding-right: 10px;
10+
}
11+
form.position-form .discuss-text {
12+
clear: left;
13+
}
14+
</style>
15+
16+
<form class="position-form" action="" method="POST">
17+
<div class="position">{{ form.position }}</div>
18+
19+
<div class="discuss-text">{{ form.discuss_text.label_tag }}:</div>
20+
{{ form.discuss_text }}
21+
22+
<div class="comment-text">{{ form.comment_text.label_tag }}:</div>
23+
<div>{{ form.comment_text }}</div>
24+
25+
<div class="actions">
26+
<a href="{{ doc.idinternal.get_absolute_url }}">Back</a>
27+
<input type="submit" value="Save"/>
28+
</div>
29+
</form>
30+

0 commit comments

Comments
 (0)