Skip to content

Commit a849d0f

Browse files
refactor: drop .txt from filename_with_rev()
1 parent 5d2958a commit a849d0f

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

ietf/doc/mails.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ def email_ad_approved_doc(request, doc, text):
4646
bcc = "iesg-secretary@ietf.org"
4747
frm = request.user.person.formatted_email()
4848
send_mail(request, to, frm,
49-
"Approved: %s" % doc.filename_with_rev(),
49+
"Approved: %s.txt" % doc.filename_with_rev(),
5050
"doc/mail/ad_approval_email.txt",
5151
dict(text=text,
52-
docname=doc.filename_with_rev()),
52+
docname=doc.filename_with_rev() + ".txt"),
5353
bcc=bcc)
5454

5555
def email_ad_approved_conflict_review(request, review, ok_to_publish):

ietf/doc/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,10 +961,10 @@ def get_related_proceedings_material(self):
961961
return self.proceedingsmaterial_set.first()
962962

963963
def file_tag(self):
964-
return "<%s>" % self.filename_with_rev()
964+
return "<%s.txt>" % self.filename_with_rev()
965965

966966
def filename_with_rev(self):
967-
return "%s-%s.txt" % (self.name, self.rev)
967+
return f"{self.name}-{self.rev}"
968968

969969
def latest_event(self, *args, **filter_args):
970970
"""Get latest event of optional Python type and with filter

ietf/meeting/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def save_agenda(self):
354354
if self.instance.agenda():
355355
doc = self.instance.agenda()
356356
doc.rev = str(int(doc.rev) + 1).zfill(2)
357-
doc.uploaded_filename = doc.filename_with_rev()
357+
doc.uploaded_filename = doc.filename_with_rev() + ".txt"
358358
e = NewRevisionDocEvent.objects.create(
359359
type='new_revision',
360360
by=self.user.person,
@@ -381,7 +381,7 @@ def save_agenda(self):
381381
rev=doc.rev,
382382
desc='New revision available')
383383
# write file
384-
path = os.path.join(self.instance.meeting.get_materials_path(), 'agenda', doc.filename_with_rev())
384+
path = os.path.join(self.instance.meeting.get_materials_path(), 'agenda', doc.filename_with_rev() + ".txt")
385385
directory = os.path.dirname(path)
386386
if not os.path.exists(directory):
387387
os.makedirs(directory)

ietf/meeting/tests_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5389,7 +5389,7 @@ def do_interim_request_single_virtual(self, emails_expected):
53895389
# ensure agenda document was created
53905390
self.assertEqual(session.materials.count(),1)
53915391
doc = session.materials.first()
5392-
path = os.path.join(doc.get_file_path(),doc.filename_with_rev())
5392+
path = os.path.join(doc.get_file_path(),doc.filename_with_rev() + ".txt")
53935393
self.assertTrue(os.path.exists(path))
53945394
with Path(path).open() as f:
53955395
self.assertEqual(f.read(), agenda)

ietf/templates/doc/document_draft.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@
654654
Referenced by
655655
</a>
656656
<a class="btn btn-primary btn-sm"
657-
href="{{ settings.IDNITS_BASE_URL }}?url=https://www.ietf.org/archive/id/{{ doc.filename_with_rev }}"
657+
href="{{ settings.IDNITS_BASE_URL }}?url=https://www.ietf.org/archive/id/{{ doc.filename_with_rev }}.txt"
658658
rel="nofollow"
659659
target="_blank">
660660
<i class="bi bi-exclamation">
@@ -664,7 +664,7 @@
664664
{% if user|has_role:"Area Director" %}
665665
{# IDNITS3 is an experimental service, so only show it to Area Directors #}
666666
<a class="btn btn-primary btn-sm"
667-
href="{{ settings.IDNITS3_BASE_URL }}?url=https://www.ietf.org/archive/id/{{ doc.filename_with_rev }}"
667+
href="{{ settings.IDNITS3_BASE_URL }}?url=https://www.ietf.org/archive/id/{{ doc.filename_with_rev }}.txt"
668668
rel="nofollow"
669669
target="_blank">
670670
<i class="bi bi-exclamation-diamond">

ietf/templates/doc/mail/approval_mail.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{% load ietf_filters %}{%load mail_filters %}{% autoescape off %}From: The IESG <iesg-secretary@ietf.org>
22
To: {{ to }}{% if cc %}
33
Cc: {{ cc }}{% endif %}
4-
Subject: {{ action_type }} Action: '{{ doc.title|clean_whitespace }}' to {{ doc|std_level_prompt }} ({{ doc.filename_with_rev }})
4+
Subject: {{ action_type }} Action: '{{ doc.title|clean_whitespace }}' to {{ doc|std_level_prompt }} ({{ doc.filename_with_rev }}.txt)
55

66
{% filter wordwrap:78 %}The IESG has approved the following document{{ docs|pluralize }}:{% for d in docs %}
77
- '{{ d.filled_title }}'
8-
({{ d.filename_with_rev }}) as {{ d|std_level_prompt }}{% endfor %}
8+
({{ d.filename_with_rev }}.txt) as {{ d|std_level_prompt }}{% endfor %}
99

1010
{{ made_by }}
1111

0 commit comments

Comments
 (0)