Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ietf/doc/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def states(obj, create, extracted, **kwargs):
else:
obj.set_state(State.objects.get(type_id='rfc',slug='published'))

@factory.post_generation
def authors(obj, create, extracted, **kwargs): # pylint: disable=no-self-argument
# Override base class, creating RfcAuthor instead of DocumentAuthor
if create and extracted:
for person in extracted:
RfcAuthorFactory(document=obj, person=person)


class IndividualDraftFactory(BaseDocumentFactory):

Expand Down
2 changes: 1 addition & 1 deletion ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def prettystdname(string, space=" "):
@register.filter
def rfceditor_info_url(rfcnum : str):
"""Link to the RFC editor info page for an RFC"""
return urljoin(settings.RFC_EDITOR_INFO_BASE_URL, f'rfc{rfcnum}')
return urljoin(settings.RFC_EDITOR_INFO_BASE_URL, f'rfc{rfcnum}/')


def doc_name(name):
Expand Down
23 changes: 15 additions & 8 deletions ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

import debug # pyflakes:ignore

from ietf.doc.models import ( Document, DocRelationshipName, RelatedDocument, State,
DocEvent, BallotPositionDocEvent, LastCallDocEvent, WriteupDocEvent, NewRevisionDocEvent, BallotType,
EditedAuthorsDocEvent, StateType)
from ietf.doc.models import (Document, DocRelationshipName, RelatedDocument, State,
DocEvent, BallotPositionDocEvent, LastCallDocEvent, WriteupDocEvent, NewRevisionDocEvent, BallotType,
EditedAuthorsDocEvent, StateType, RfcAuthor)
from ietf.doc.factories import (DocumentFactory, DocEventFactory, CharterFactory,
ConflictReviewFactory, WgDraftFactory,
IndividualDraftFactory, WgRfcFactory,
Expand Down Expand Up @@ -73,7 +73,7 @@
from ietf.utils.mail import get_payload_text, outbox, empty_outbox
from ietf.utils.test_utils import login_testing_unauthorized, unicontent
from ietf.utils.test_utils import TestCase
from ietf.utils.text import normalize_text
from ietf.utils.text import normalize_text, texescape
from ietf.utils.timezone import date_today, datetime_today, DEADLINE_TZINFO, RPC_TZINFO
from ietf.doc.utils_search import AD_WORKLOAD

Expand Down Expand Up @@ -2133,9 +2133,11 @@ def test_document_bibtex(self):
doc = factory()
url = urlreverse("ietf.doc.views_doc.document_bibtex", kwargs=dict(name=doc.name))
r = self.client.get(url)
self.assertEqual(r.status_code, 404)
self.assertEqual(r.status_code, 404)
authors = PersonFactory.create_batch(2)
rfc = WgRfcFactory.create(
time=datetime.datetime(2010, 10, 10, tzinfo=ZoneInfo(settings.TIME_ZONE))
time=datetime.datetime(2010, 10, 10, tzinfo=ZoneInfo(settings.TIME_ZONE)),
authors=authors,
)
num = rfc.rfc_number
DocEventFactory.create(
Expand All @@ -2152,7 +2154,12 @@ def test_document_bibtex(self):
self.assertEqual(entry["doi"], "10.17487/RFC%s" % num)
self.assertEqual(entry["year"], "2010")
self.assertEqual(entry["month"].lower()[0:3], "oct")
self.assertEqual(entry["url"], f"https://www.rfc-editor.ietf.org/info/rfc{num}")
self.assertEqual(entry["url"], f"https://www.rfc-editor.ietf.org/info/rfc{num}/")
escaped_author_names = [
texescape(ra.titlepage_name)
for ra in RfcAuthor.objects.filter(document=rfc)
]
self.assertEqual(entry["author"], " and ".join(escaped_author_names))
#
self.assertNotIn("day", entry)

Expand Down Expand Up @@ -2188,7 +2195,7 @@ def test_document_bibtex(self):
self.assertEqual(entry["year"], "1990")
self.assertEqual(entry["month"].lower()[0:3], "apr")
self.assertEqual(entry["day"], "1")
self.assertEqual(entry["url"], f"https://www.rfc-editor.ietf.org/info/rfc{num}")
self.assertEqual(entry["url"], f"https://www.rfc-editor.ietf.org/info/rfc{num}/")

draft = IndividualDraftFactory.create()
docname = "%s-%s" % (draft.name, draft.rev)
Expand Down
18 changes: 4 additions & 14 deletions ietf/nomcom/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
RfcAuthorFactory,
WgDraftFactory, WgRfcFactory,
)
from ietf.doc.models import RfcAuthor
from ietf.group.factories import GroupFactory, GroupHistoryFactory, RoleFactory, RoleHistoryFactory
from ietf.group.models import Group, Role
from ietf.meeting.factories import MeetingFactory, AttendedFactory, RegistrationFactory
Expand Down Expand Up @@ -2521,19 +2522,6 @@ def test_get_qualified_author_queryset(self):
people, # does not include extra_person!
)

# Now add an RfcAuthor for only one of the two authors to the RFC. This should
# remove the other author from the eligibility list because the DocumentAuthor
# records are no longer used.
RfcAuthorFactory(
document=rfc,
person=people[0],
titlepage_name="P. Zero",
)
self.assertCountEqual(
get_qualified_author_queryset(base_qs, now - 5 * one_year, now),
[people[0]],
)


class rfc8713EligibilityTests(TestCase):

Expand Down Expand Up @@ -2861,7 +2849,9 @@ def test_elig_by_author(self):
self.assertFalse(is_eligible(person,nomcom))

self.assertEqual(set(list_eligible(nomcom=nomcom)),set(eligible))
Person.objects.filter(pk__in=[p.pk for p in eligible.union(ineligible)]).delete()
people_pks_to_delete = [p.pk for p in eligible.union(ineligible)]
RfcAuthor.objects.filter(person__pk__in=people_pks_to_delete).delete()
Person.objects.filter(pk__in=people_pks_to_delete).delete()

class rfc9389EligibilityTests(TestCase):

Expand Down
6 changes: 3 additions & 3 deletions ietf/templates/doc/document_bibtex.bib
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
{% if doc.type_id == "rfc" %}
{% if doc.stream|slugify == "legacy" %}
% Datatracker information for RFCs on the Legacy Stream is unfortunately often
% incorrect. Please correct the bibtex below based on the information in the
% actual RFC at https://rfc-editor.org/rfc/rfc{{ doc.rfc_number }}.txt
% incorrect. Please correct the bibtex below based on the information available
% at {{ doc.rfc_number|rfceditor_info_url }}
{% endif %}
@misc{% templatetag openbrace %}rfc{{ doc.rfc_number }},
series = {Request for Comments},
Expand All @@ -25,7 +25,7 @@ @techreport{
publisher = {% templatetag openbrace %}Internet Engineering Task Force{% templatetag closebrace %},
note = {% templatetag openbrace %}Work in Progress{% templatetag closebrace %},
url = {% templatetag openbrace %}{{ settings.IDTRACKER_BASE_URL }}{% url 'ietf.doc.views_doc.document_main' name=doc.name rev=doc.rev %}{% templatetag closebrace %},{% endif %}
author = {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name|texescape}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %},
author = {% templatetag openbrace %}{% for author in doc.author_persons_or_names %}{% firstof author.titlepage_name|texescape author.person.name|texescape %}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %},
title = {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title|texescape}}{% templatetag closebrace %}{% templatetag closebrace %},
pagetotal = {{ doc.pages }},
year = {{ doc.pub_date.year }},
Expand Down
Loading