Skip to content

Commit c8af089

Browse files
committed
Fix a bug which made the community tracking code crash when search results would show an old RFC without an associated draft.
- Legacy-Id: 4569
1 parent 7189459 commit c8af089

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

ietf/community/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ietf.community.models import CommunityList, Rule, EmailSubscription, ListNotification
1616
from ietf.community.forms import RuleForm, DisplayForm, SubscribeForm, UnSubscribeForm
1717
from ietf.group.models import Group
18-
from ietf.doc.models import Document, DocEvent
18+
from ietf.doc.models import Document, DocEvent, DocAlias
1919

2020

2121
def _manage_list(request, clist):
@@ -77,7 +77,7 @@ def add_document(request, document_name):
7777
path = urlquote(request.get_full_path())
7878
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
7979
return HttpResponseRedirect('%s?%s=%s' % tup)
80-
doc = get_object_or_404(Document, name=document_name)
80+
doc = get_object_or_404(DocAlias, name=document_name).document
8181
clist = CommunityList.objects.get_or_create(user=request.user)[0]
8282
clist.update()
8383
return add_document_to_list(request, clist, doc)
@@ -89,7 +89,7 @@ def remove_document(request, list_id, document_name):
8989
path = urlquote(request.get_full_path())
9090
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
9191
return HttpResponseRedirect('%s?%s=%s' % tup)
92-
doc = get_object_or_404(Document, name=document_name)
92+
doc = get_object_or_404(DocAlias, name=document_name).document
9393
clist.added_ids.remove(doc)
9494
clist.update()
9595
return HttpResponseRedirect(clist.get_manage_url())

ietf/idrfc/idrfc_wrapper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from django.core.urlresolvers import reverse
4444
from django.conf import settings
4545
import types
46+
import debug
4647

4748
BALLOT_ACTIVE_STATES = ['In Last Call',
4849
'Waiting for Writeup',
@@ -390,6 +391,12 @@ def ad_name(self):
390391
else:
391392
# TODO: get AD name of the draft
392393
return None
394+
def filename(self):
395+
debug.show('self')
396+
debug.show('self._rfc')
397+
debug.show('self._rfcindex')
398+
debug.show('self._rfcindex.filename')
399+
return self._rfcindex.filename
393400

394401
@models.permalink
395402
def get_absolute_url(self):

ietf/templates/idrfc/search_result_row.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
3838
{% if user.is_authenticated and show_add_to_list %}
3939
<td class="addtolist">
40-
<a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a>
40+
{% if doc.id %}
41+
<a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a>
42+
{% else %}
43+
<a href="{% url community_add_document doc.rfc.filename %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a>
44+
{% endif %}
4145
</td>
4246
{% endif %}
4347
<td class="doc">

0 commit comments

Comments
 (0)