11# edit/create view for groups
22
33import re
4- import os
54import datetime
6- import shutil
75
86from django import forms
97from django .shortcuts import render , get_object_or_404 , redirect
1311
1412import 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
1715from ietf .doc .utils import get_tags_for_stream_id
16+ from ietf .doc .utils_charter import charter_name_for_group
1817from ietf .group .models import ( Group , Role , GroupEvent , GroupHistory , GroupStateName ,
1918 GroupStateTransitions , GroupTypeName , GroupURL , ChangeStateGroupEvent )
2019from 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
136135def 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