Make Document.href() point at the rfc when doc.is_rfc().

- Legacy-Id: 13988
This commit is contained in:
Henrik Levkowetz 2017-07-27 15:28:11 +00:00
parent c8336b9ca0
commit 4295396891
2 changed files with 11 additions and 3 deletions

View file

@ -202,7 +202,10 @@ class DocumentInfo(models.Model):
format = settings.DOC_HREFS[self.type_id]
elif self.type_id in settings.DOC_HREFS:
self.is_meeting_related = False
format = settings.DOC_HREFS[self.type_id]
if self.is_rfc():
format = settings.DOC_HREFS['rfc']
else:
format = settings.DOC_HREFS[self.type_id]
elif self.type_id in settings.MEETING_DOC_HREFS:
self.is_meeting_related = True
format = settings.MEETING_DOC_HREFS[self.type_id]
@ -690,6 +693,10 @@ class Document(DocumentInfo):
logger.error("Document self.is_rfc() is True but self.canonical_name() is %s" % n)
return self._cached_rfc_number
@property
def rfcnum(self):
return self.rfc_number()
def ipr(self,states=('posted','removed')):
"""Returns the IPR disclosures against this document (as a queryset over IprDocRel)."""
from ietf.ipr.models import IprDocRel

View file

@ -585,8 +585,9 @@ LIAISON_ATTACH_URL = 'https://www.ietf.org/lib/dt/documents/LIAISON/' # should e
# Ideally, more of these would be local -- but since we don't support
# versions right now, we'll point to external websites
DOC_HREFS = {
"charter": "https://www.ietf.org/charter/{doc.name}-{doc.rev}.txt",
"draft": "https://www.ietf.org/archive/id/{doc.name}-{doc.rev}.txt",
"charter": "https://www.ietf.org/charter/{doc.name}-{doc.rev}.txt",
"draft": "https://www.ietf.org/archive/id/{doc.name}-{doc.rev}.txt",
"rfc": "https://www.rfc-editor.org/rfc/rfc{doc.rfcnum}.txt",
"slides": "https://www.ietf.org/slides/{doc.name}-{doc.rev}",
"conflrev": "https://www.ietf.org/cr/{doc.name}-{doc.rev}.txt",
"statchg": "https://www.ietf.org/sc/{doc.name}-{doc.rev}.txt",