Skip to content

Commit e92e57a

Browse files
committed
Fix an instance of charter-ietf-%s that should really be charter-%s-%s
to support RG charters properly, also remove the dead code for handling group acronym renames (it contained some instances of charter-ietf-%s too) - Legacy-Id: 7936
1 parent f9ee750 commit e92e57a

3 files changed

Lines changed: 12 additions & 23 deletions

File tree

ietf/doc/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ def canonical_name(self):
288288
if a:
289289
name = a[0].name
290290
elif self.type_id == "charter":
291-
return "charter-ietf-%s" % self.chartered_group.acronym
291+
from ietf.doc.utils_charter import charter_name_for_group
292+
return charter_name_for_group(self.chartered_group)
292293
return name
293294

294295
def canonical_docalias(self):

ietf/doc/utils_charter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
from ietf.utils.history import find_history_active_at
1010
from ietf.utils.mail import send_mail_text
1111

12+
def charter_name_for_group(group):
13+
if group.type_id == "rg":
14+
top_org = "irtf"
15+
else:
16+
top_org = "ietf"
17+
18+
return "charter-%s-%s" % (top_org, group.acronym)
1219

1320
def next_revision(rev):
1421
if rev == "":

ietf/group/edit.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# edit/create view for groups
22

33
import re
4-
import os
54
import datetime
6-
import shutil
75

86
from django import forms
97
from django.shortcuts import render, get_object_or_404, redirect
@@ -13,8 +11,9 @@
1311

1412
import debug # pyflakes:ignore
1513

16-
from ietf.doc.models import Document, DocAlias, DocTagName, State, save_document_in_history
14+
from ietf.doc.models import Document, DocAlias, DocTagName, State
1715
from ietf.doc.utils import get_tags_for_stream_id
16+
from ietf.doc.utils_charter import charter_name_for_group
1817
from ietf.group.models import ( Group, Role, GroupEvent, GroupHistory, GroupStateName,
1918
GroupStateTransitions, GroupTypeName, GroupURL, ChangeStateGroupEvent )
2019
from ietf.group.utils import save_group_in_history, can_manage_group_type
@@ -134,12 +133,7 @@ def format_urls(urls, fs="\n"):
134133
return fs.join(res)
135134

136135
def get_or_create_initial_charter(group, group_type):
137-
if group_type == "rg":
138-
top_org = "irtf"
139-
else:
140-
top_org = "ietf"
141-
142-
charter_name = "charter-%s-%s" % (top_org, group.acronym)
136+
charter_name = charter_name_for_group(group)
143137

144138
try:
145139
charter = Document.objects.get(docalias__name=charter_name)
@@ -239,8 +233,6 @@ def diff(attr, name):
239233
changes.append(desc(name, clean[attr], v))
240234
setattr(group, attr, clean[attr])
241235

242-
prev_acronym = group.acronym
243-
244236
# update the attributes, keeping track of what we're doing
245237
diff('name', "Name")
246238
diff('acronym', "Acronym")
@@ -251,17 +243,6 @@ def diff(attr, name):
251243
diff('list_subscribe', "Mailing list subscribe address")
252244
diff('list_archive', "Mailing list archive")
253245

254-
if not new_group and group.acronym != prev_acronym and group.charter:
255-
save_document_in_history(group.charter)
256-
DocAlias.objects.get_or_create(
257-
name="charter-ietf-%s" % group.acronym,
258-
document=group.charter,
259-
)
260-
old = os.path.join(group.charter.get_file_path(), 'charter-ietf-%s-%s.txt' % (prev_acronym, group.charter.rev))
261-
if os.path.exists(old):
262-
new = os.path.join(group.charter.get_file_path(), 'charter-ietf-%s-%s.txt' % (group.acronym, group.charter.rev))
263-
shutil.copy(old, new)
264-
265246
# update roles
266247
for attr, slug, title in [('chairs', 'chair', "Chairs"), ('secretaries', 'secr', "Secretaries"), ('techadv', 'techadv', "Tech Advisors"), ('delegates', 'delegate', "Delegates")]:
267248
new = clean[attr]

0 commit comments

Comments
 (0)