Skip to content

Commit 55cef62

Browse files
committed
Merged in [8305] from rjsparks@nostrum.com:\n Replaces the return_to_url notion with logic that uses the session object. Related to bug ietf-tools#1430.
- Legacy-Id: 8483 Note: SVN reference [8305] has been migrated to Git commit feb57a0
2 parents 6687a36 + feb57a0 commit 55cef62

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

ietf/doc/views_ballot.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class EditPositionForm(forms.Form):
8585
position = forms.ModelChoiceField(queryset=BallotPositionName.objects.all(), widget=forms.RadioSelect, initial="norecord", required=True)
8686
discuss = forms.CharField(required=False, widget=forms.Textarea)
8787
comment = forms.CharField(required=False, widget=forms.Textarea)
88-
return_to_url = forms.CharField(required=False, widget=forms.HiddenInput)
8988

9089
def __init__(self, *args, **kwargs):
9190
ballot_type = kwargs.pop("ballot_type")
@@ -107,8 +106,8 @@ def edit_position(request, name, ballot_id):
107106

108107
ad = login = request.user.person
109108

110-
if 'HTTP_REFERER' in request.META:
111-
return_to_url = request.META['HTTP_REFERER']
109+
if 'ballot_edit_return_point' in request.session:
110+
return_to_url = request.session['ballot_edit_return_point']
112111
else:
113112
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
114113

@@ -131,9 +130,6 @@ def edit_position(request, name, ballot_id):
131130
# save the vote
132131
clean = form.cleaned_data
133132

134-
if clean['return_to_url']:
135-
return_to_url = clean['return_to_url']
136-
137133
pos = BallotPositionDocEvent(doc=doc, by=login)
138134
pos.type = "changed_ballot_position"
139135
pos.ballot = ballot
@@ -195,9 +191,9 @@ def edit_position(request, name, ballot_id):
195191
e.save() # save them after the position is saved to get later id for sorting order
196192

197193
if request.POST.get("send_mail"):
198-
qstr = "?return_to_url=%s" % return_to_url
194+
qstr=""
199195
if request.GET.get('ad'):
200-
qstr += "&ad=%s" % request.GET.get('ad')
196+
qstr += "?ad=%s" % request.GET.get('ad')
201197
return HttpResponseRedirect(urlreverse("doc_send_ballot_comment", kwargs=dict(name=doc.name, ballot_id=ballot_id)) + qstr)
202198
elif request.POST.get("Defer"):
203199
return redirect("doc_defer_ballot", name=doc)
@@ -212,9 +208,6 @@ def edit_position(request, name, ballot_id):
212208
initial['discuss'] = old_pos.discuss
213209
initial['comment'] = old_pos.comment
214210

215-
if return_to_url:
216-
initial['return_to_url'] = return_to_url
217-
218211
form = EditPositionForm(initial=initial, ballot_type=ballot.ballot_type)
219212

220213
blocking_positions = dict((p.pk, p.name) for p in form.fields["position"].queryset.all() if p.blocking)
@@ -243,8 +236,9 @@ def send_ballot_comment(request, name, ballot_id):
243236

244237
ad = request.user.person
245238

246-
return_to_url = request.GET.get('return_to_url')
247-
if not return_to_url:
239+
if 'ballot_edit_return_point' in request.session:
240+
return_to_url = request.session['ballot_edit_return_point']
241+
else:
248242
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
249243

250244
if 'HTTP_REFERER' in request.META:

ietf/doc/views_doc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ def document_ballot(request, name, ballot_id=None):
757757

758758
c = document_ballot_content(request, doc, ballot_id, editable=True)
759759

760+
request.session['ballot_edit_return_point'] = request.path_info
761+
760762
return render_to_response("doc/document_ballot.html",
761763
dict(doc=doc,
762764
top=top,

ietf/iesg/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def agenda(request, date=None):
179179
data["sections"]["1.1"]["title"] = data["sections"]["1.1"]["title"].replace("Roll Call", '<a href="https://www.ietf.org/iesg/internal/rollcall.txt">Roll Call</a>')
180180
data["sections"]["1.3"]["title"] = data["sections"]["1.3"]["title"].replace("Minutes", '<a href="https://www.ietf.org/iesg/internal/minutes.txt">Minutes</a>')
181181

182+
request.session['ballot_edit_return_point'] = request.path_info
182183
return render_to_response("iesg/agenda.html", {
183184
"date": data["date"],
184185
"sections": sorted(data["sections"].iteritems()),
@@ -366,6 +367,7 @@ def agenda_documents(request):
366367
"sections": sorted((num, section) for num, section in sections.iteritems()
367368
if "2" <= num < "5")
368369
})
370+
request.session['ballot_edit_return_point'] = request.path_info
369371
return render(request, 'iesg/agenda_documents.html', { 'telechats': telechats })
370372

371373
def telechat_docs_tarfile(request, date):

0 commit comments

Comments
 (0)