chore: repair damage from bulk changes

This commit is contained in:
Robert Sparks 2023-08-18 13:44:05 -05:00
parent 823281ba6c
commit 90ca856afa
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318
4 changed files with 7 additions and 5 deletions

View file

@ -328,7 +328,7 @@ def rfcdiff_latest_json(request, name, rev=None):
response = dict()
condition, document, history, found_rev = find_doc_for_rfcdiff(name, rev)
if document.type_id == "rfc":
draft_alias = next(iter(document.related_that('became_rfc')), None)
draft = next(iter(document.related_that('became_rfc')), None)
if condition == 'no such document':
raise Http404
elif condition in ('historic version', 'current version'):
@ -336,8 +336,7 @@ def rfcdiff_latest_json(request, name, rev=None):
if doc.type_id == "rfc":
response['content_url'] = doc.get_href()
response['name']=doc.name
if draft_alias:
draft = draft_alias.document
if draft:
prev_rev = draft.rev
if doc.rfc_number in HAS_TOMBSTONE and prev_rev != '00':
prev_rev = f'{(int(draft.rev)-1):02d}'

View file

@ -949,7 +949,7 @@ class Document(DocumentInfo):
from ietf.ipr.models import IprDocRel
iprs = (
IprDocRel.objects.filter(
document__in=list(self)
document__in=[self]
+ self.all_related_that_doc(("obs", "replaces"))
)
.filter(disclosure__state__in=("posted", "removed"))

View file

@ -250,12 +250,15 @@ def urlize_ietf_docs(string, autoescape=None):
string,
flags=re.IGNORECASE | re.ASCII,
)
debug.show('string')
string = re.sub(
r"\b(?<![/\-:=#\"\'])((RFC|BCP|STD|FYI) *\n? *0*(\d+))\b",
link_other_doc_match,
string,
flags=re.IGNORECASE | re.ASCII,
)
debug.show('string')
return mark_safe(string)

View file

@ -150,7 +150,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
rel_rfcs = {
a.document.id: re.sub(r"rfc(\d+)", r"RFC \1", a.name, flags=re.IGNORECASE)
for a in Document.objects.filter(
type_id="rfc", docs__id__in=[rel.source_id for rel in xed_by]
type_id="rfc", id__in=[rel.source_id for rel in xed_by]
)
}
xed_by.sort(