Skip to content

Commit ea7728b

Browse files
committed
Changed calls to .related_that*() and .relations_that*() to use tuples rather than lists (a slight optimization).
- Legacy-Id: 15029
1 parent 9e51072 commit ea7728b

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,12 +870,12 @@ def document_shepherd_writeup(request, name):
870870

871871
def document_references(request, name):
872872
doc = get_object_or_404(Document,docalias__name=name)
873-
refs = doc.relations_that_doc(['refnorm','refinfo','refunk','refold'])
873+
refs = doc.relations_that_doc(('refnorm','refinfo','refunk','refold'))
874874
return render(request, "doc/document_references.html",dict(doc=doc,refs=sorted(refs,key=lambda x:x.target.name),))
875875

876876
def document_referenced_by(request, name):
877877
doc = get_object_or_404(Document,docalias__name=name)
878-
refs = doc.relations_that(['refnorm','refinfo','refunk','refold']).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
878+
refs = doc.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
879879
full = ( request.GET.get('full') != None )
880880
numdocs = refs.count()
881881
if not full and numdocs>250:

ietf/ipr/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_iprs_for_drafts(self):
168168

169169
def test_iprs_for_drafts_recursive(self):
170170
draft = make_test_data()
171-
replaced = draft.all_related_that_doc(['replaces'])
171+
replaced = draft.all_related_that_doc('replaces')
172172
ipr = IprDisclosureBase.objects.get(title='Statement regarding rights')
173173
r = self.client.get(urlreverse("ietf.ipr.views.by_draft_recursive_txt"))
174174
self.assertEqual(r.status_code, 200)

ietf/ipr/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def by_draft_recursive_txt(request):
461461
alias = o.document
462462
document = alias.document
463463
name = alias.name
464-
related = set(document.docalias_set.all()) | set(document.all_related_that_doc(['obs', 'replaces']))
464+
related = set(document.docalias_set.all()) | set(document.all_related_that_doc(('obs', 'replaces')))
465465
for alias in related:
466466
name = alias.name
467467
if name.startswith("rfc"):
@@ -671,7 +671,7 @@ def search(request):
671671
docs = related_docs(first)
672672
iprs = iprs_from_docs(docs,states=states)
673673
template = "ipr/search_doc_result.html"
674-
updated_docs = related_docs(first, ['updates',])
674+
updated_docs = related_docs(first, ('updates',))
675675
related_iprs = list(set(iprs_from_docs(updated_docs, states=states)) - set(iprs))
676676
# multiple matches, select just one
677677
elif start:

ietf/mailtrigger/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,35 +91,35 @@ def gather_doc_group_mail_list(self, **kwargs):
9191
def gather_doc_affecteddoc_authors(self, **kwargs):
9292
addrs = []
9393
if 'doc' in kwargs:
94-
for reldoc in kwargs['doc'].related_that_doc(['conflrev','tohist','tois','tops']):
94+
for reldoc in kwargs['doc'].related_that_doc(('conflrev','tohist','tois','tops')):
9595
addrs.extend(Recipient.objects.get(slug='doc_authors').gather(**{'doc':reldoc.document}))
9696
return addrs
9797

9898
def gather_doc_affecteddoc_group_chairs(self, **kwargs):
9999
addrs = []
100100
if 'doc' in kwargs:
101-
for reldoc in kwargs['doc'].related_that_doc(['conflrev','tohist','tois','tops']):
101+
for reldoc in kwargs['doc'].related_that_doc(('conflrev','tohist','tois','tops')):
102102
addrs.extend(Recipient.objects.get(slug='doc_group_chairs').gather(**{'doc':reldoc.document}))
103103
return addrs
104104

105105
def gather_doc_affecteddoc_notify(self, **kwargs):
106106
addrs = []
107107
if 'doc' in kwargs:
108-
for reldoc in kwargs['doc'].related_that_doc(['conflrev','tohist','tois','tops']):
108+
for reldoc in kwargs['doc'].related_that_doc(('conflrev','tohist','tois','tops')):
109109
addrs.extend(Recipient.objects.get(slug='doc_notify').gather(**{'doc':reldoc.document}))
110110
return addrs
111111

112112
def gather_conflict_review_stream_manager(self, **kwargs):
113113
addrs = []
114114
if 'doc' in kwargs:
115-
for reldoc in kwargs['doc'].related_that_doc(['conflrev']):
115+
for reldoc in kwargs['doc'].related_that_doc(('conflrev',)):
116116
addrs.extend(Recipient.objects.get(slug='doc_stream_manager').gather(**{'doc':reldoc.document}))
117117
return addrs
118118

119119
def gather_conflict_review_steering_group(self,**kwargs):
120120
addrs = []
121121
if 'doc' in kwargs:
122-
for reldoc in kwargs['doc'].related_that_doc(['conflrev']):
122+
for reldoc in kwargs['doc'].related_that_doc(('conflrev',)):
123123
if reldoc.document.stream_id=='irtf':
124124
addrs.append('"Internet Research Steering Group" <irsg@irtf.org>')
125125
return addrs

0 commit comments

Comments
 (0)