Copy charter text so we have an appriopriately named charter file when
renaming group acronyms. - Legacy-Id: 4315
This commit is contained in:
parent
6088bb4758
commit
d176d2b161
|
@ -1,6 +1,6 @@
|
|||
# edit/create view for WGs
|
||||
|
||||
import re, os, string, datetime
|
||||
import re, os, string, datetime, shutil
|
||||
|
||||
from django.shortcuts import render_to_response, get_object_or_404, redirect
|
||||
from django.core.urlresolvers import reverse
|
||||
|
@ -142,14 +142,8 @@ def edit(request, acronym=None, action="edit"):
|
|||
if r[attr] != v:
|
||||
changes.append(desc(name, r[attr], v))
|
||||
setattr(wg, attr, r[attr])
|
||||
if attr == "acronym":
|
||||
c = wg.charter
|
||||
save_document_in_history(c)
|
||||
# and add a DocAlias
|
||||
DocAlias.objects.create(
|
||||
name="charter-ietf-%s" % r['acronym'],
|
||||
document=c,
|
||||
)
|
||||
|
||||
prev_acronym = wg.acronym
|
||||
|
||||
# update the attributes, keeping track of what we're doing
|
||||
diff('name', "Name")
|
||||
|
@ -159,7 +153,18 @@ def edit(request, acronym=None, action="edit"):
|
|||
diff('list_email', "Mailing list email")
|
||||
diff('list_subscribe', "Mailing list subscribe address")
|
||||
diff('list_archive', "Mailing list archive")
|
||||
|
||||
|
||||
if not new_wg and wg.acronym != prev_acronym:
|
||||
save_document_in_history(wg.charter)
|
||||
DocAlias.objects.get_or_create(
|
||||
name="charter-ietf-%s" % wg.acronym,
|
||||
document=wg.charter,
|
||||
)
|
||||
old = os.path.join(wg.charter.get_file_path(), 'charter-ietf-%s-%s.txt' % (prev_acronym, wg.charter.rev))
|
||||
if os.path.exists(old):
|
||||
new = os.path.join(wg.charter.get_file_path(), 'charter-ietf-%s-%s.txt' % (wg.acronym, wg.charter.rev))
|
||||
shutil.copy(old, new)
|
||||
|
||||
# update roles
|
||||
for attr, slug, title in [('chairs', 'chair', "Chairs"), ('secretaries', 'secr', "Secretaries"), ('techadv', 'techadv', "Tech Advisors")]:
|
||||
new = r[attr]
|
||||
|
|
|
@ -157,6 +157,8 @@ class WgEditTestCase(django.test.TestCase):
|
|||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
|
||||
# edit info
|
||||
with open(os.path.join(self.charter_dir, "%s-%s.txt" % (group.charter.canonical_name(), group.charter.rev)), "w") as f:
|
||||
f.write("This is a charter.")
|
||||
area = group.parent
|
||||
ad = Person.objects.get(name="Aread Irector")
|
||||
r = self.client.post(url,
|
||||
|
@ -185,6 +187,7 @@ class WgEditTestCase(django.test.TestCase):
|
|||
self.assertEquals(group.list_archive, "archive.mars")
|
||||
self.assertEquals(group.groupurl_set.all()[0].url, "http://mars.mars")
|
||||
self.assertEquals(group.groupurl_set.all()[0].name, "MARS site")
|
||||
self.assertTrue(os.path.exists(os.path.join(self.charter_dir, "%s-%s.txt" % (group.charter.canonical_name(), group.charter.rev))))
|
||||
|
||||
def test_conclude(self):
|
||||
make_test_data()
|
||||
|
|
Loading…
Reference in a new issue