Fixed some bugs that occur when you change the acronym of a WG

- Legacy-Id: 3361
This commit is contained in:
Martin Qvist 2011-08-24 13:05:40 +00:00
parent ecac9c2e11
commit 533cbe9eeb
9 changed files with 42 additions and 31 deletions

View file

@ -13,7 +13,7 @@ Copyright The IETF Trust 2011, All Rights Reserved
{% if c.is_rev %}
<td>{{ c.info.version }}</td>
<td>(System)</td>
<td>New version available: <a href="{{ c.txt_url }}{{ c.charter.name }}-{{c.charter.rev}}.txt">{{ c.charter.name }}-{{ c.charter.rev }}</a> {% if c.prev_charter %}(<a href="http://tools.ietf.org/rfcdiff?url1={{ c.txt_url }}{{ c.charter.name }}-{{c.charter.rev}}.txt&url2={{ c.txt_url }}{{ c.prev_charter.name }}-{{c.prev_charter.rev}}.txt">diff from -{{ c.prev_charter.rev }}</a>){% endif %}</td>
<td>New version available: <a href="{{ c.txt_url }}charter-ietf-{{ c.group.acronym }}-{{c.charter.rev}}.txt">charter-ietf-{{ c.group.acronym }}-{{ c.charter.rev }}</a> {% if c.prev_charter %}(<a href="http://tools.ietf.org/rfcdiff?url1={{ c.txt_url }}charter-ietf-{{ c.group.acronym }}-{{c.charter.rev}}.txt&url2={{ c.txt_url }}charter-ietf-{{ c.prev_group.acronym }}-{{c.prev_charter.rev}}.txt">diff from -{{ c.prev_charter.rev }}</a>){% endif %}</td>
{% endif %}
{% if c.is_com %}

View file

@ -66,7 +66,7 @@ Snapshots: {% if not snapshot %}<strong>{% else %}<a href="{% url wg_view_record
{% block charter_text %}
{% ifnotequal charter.rev "" %}
<p>Other versions: <a href="{{ charter_text_url }}{{wg.charter.name}}-{{rev}}.txt">plain text</a></p>
<p>Other versions: <a href="{{ charter_text_url }}{{charter.name}}-{{rev}}.txt">plain text</a></p>
<h3>Charter {{ charter.name }}-{{ rev }}</h3>

View file

@ -54,8 +54,8 @@ class GroupComments(Feed):
else:
h['rev'] = obj.charter.rev
h['charter'] = _get_html(
str(obj.charter.name)+"-"+str(obj.charter.rev)+",html",
os.path.join(obj.charter.get_file_path(), obj.charter.name+"-"+obj.charter.rev+".txt"))
"charter-ietf-"+str(obj.acronym)+"-"+str(obj.charter.rev)+",html",
os.path.join(obj.charter.get_file_path(), "charter-ietf-"+obj.acronym+"-"+obj.charter.rev+".txt"))
return history
def item_link(self, obj):

View file

@ -116,12 +116,12 @@ def log_group_state_changed(request, wg, by, note=''):
e.save()
return e
def log_info_changed(request, wg, by, type=None, note=''):
def log_info_changed(request, wg, by, note=''):
from group.models import GroupEvent
e = GroupEvent(group=wg, by=by)
e.type = "changed_record"
e.desc = u"Info changed"
e.type = "info_changed"
e.desc = "WG info changed: "
if note:
e.desc += "<br>%s" % note
@ -213,7 +213,7 @@ def update_telechat(request, doc, by, new_telechat_date):
new_telechat_date, by.name)
else:
e.desc = "Removed from agenda for telechat by %s" % by.name
e.save()
elif on_agenda and new_telechat_date != prev_telechat:
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b> by %s" % (new_telechat_date, prev_telechat, by.name)
e.save()
e.save()

View file

@ -406,13 +406,15 @@ def approve_ballot(request, name):
wg.time = e.time
wg.save()
filename = os.path.join(charter.get_file_path(), charter.name+"-"+charter.rev+".txt")
if not settings.DONT_COPY_CHARTER_ON_APPROVE:
ch = get_charter_for_revision(wg.charter, wg.charter.rev)
filename = os.path.join(charter.get_file_path(), ch.name+"-"+ch.rev+".txt")
if not hasattr(settings, 'DONT_COPY_CHARTER_ON_APPROVE') or not settings.DONT_COPY_CHARTER_ON_APPROVE:
try:
source = open(filename, 'rb')
raw_content = source.read()
new_filename = os.path.join(charter.get_file_path(), charter.name+"-"+charter.rev+".txt")
new_filename = os.path.join(charter.get_file_path(), 'charter-ietf-%s-%s.txt' % (wg.acronym, next_approved_revision(ch.rev)))
destination = open(new_filename, 'wb+')
destination.write(raw_content)
destination.close()

View file

@ -116,14 +116,14 @@ def change_state(request, name):
e.desc = "IESG process started in state <b>%s</b>" % charter.charter_state.name
e.save()
if form.cleaned_data["charter_state"].slug == "infrev" and form.cleaned_data["initial_time"] and form.cleaned_data["initial_time"] != 0:
e = InitialReviewDocEvent()
e.type = "initial_review"
e.by = login
e.doc = charter
e.expires = datetime.now() + timedelta(weeks=form.cleaned_data["initial_time"])
e.desc = "Initial review time expires %s" % e.expires.strftime("%Y-%m-%d")
e.save()
if form.cleaned_data["charter_state"].slug == "infrev" and form.cleaned_data["initial_time"] and form.cleaned_data["initial_time"] != 0:
e = InitialReviewDocEvent()
e.type = "initial_review"
e.by = login
e.doc = charter
e.expires = datetime.now() + timedelta(weeks=form.cleaned_data["initial_time"])
e.desc = "Initial review time expires %s" % e.expires.strftime("%Y-%m-%d")
e.save()
return redirect('wg_view_record', name=wg.acronym)
else:
@ -315,6 +315,9 @@ def edit_info(request, name=None):
new = get_sorted_string(attr, ",")
old = [x.email.address for x in wg.role_set.filter(name__name=rname).order_by('email__address')]
if new != old:
changes.append(desc(rname,
",".join([Person.objects.get(email__address=x).name for x in new]),
",".join([Person.objects.get(email__address=x).name for x in old])))
# Remove old roles and save them in history
for role in wg.role_set.filter(name__name=rname):
role.delete()

View file

@ -60,13 +60,13 @@ def wg_main(request, name, rev, tab):
info = {}
info['prev_acronyms'] = list(set([x.acronym for x in wg.history_set.exclude(acronym=wg.acronym)]))
prev_list_email = list(set([x.list_email for x in wg.history_set.exclude(list_email=wg.list_email)]))
prev_list_email = list(set([x.list_email for x in wg.history_set.exclude(list_email=wg.list_email) if x.list_email != u'']))
if prev_list_email != [u'']:
info['prev_list_email'] = prev_list_email
prev_list_subscribe = list(set([x.list_email for x in wg.history_set.exclude(list_subscribe=wg.list_subscribe)]))
prev_list_subscribe = list(set([x.list_subscribe for x in wg.history_set.exclude(list_subscribe=wg.list_subscribe) if x.list_subscribe != u'']))
if prev_list_subscribe != [u'']:
info['prev_list_subscribe'] = prev_list_subscribe
prev_list_archive = list(set([x.list_archive for x in wg.history_set.exclude(list_archive=wg.list_archive)]))
prev_list_archive = list(set([x.list_archive for x in wg.history_set.exclude(list_archive=wg.list_archive) if x.list_archive != u'']))
if prev_list_archive != [u'']:
info['prev_list_archive'] = prev_list_archive
info['chairs'] = [x.email.person.name for x in wg.role_set.filter(name__slug="chair")]
@ -80,8 +80,8 @@ def wg_main(request, name, rev, tab):
if ch:
file_path = wg.charter.get_file_path() # Get from wg.charter
content = _get_html(
str(ch.name)+"-"+str(ch.rev)+",html",
os.path.join(file_path, ch.name+"-"+ch.rev+".txt"))
"charter-ietf-"+str(gh.acronym)+"-"+str(ch.rev)+",html",
os.path.join(file_path, "charter-ietf-"+gh.acronym+"-"+ch.rev+".txt"))
active_ads = list(Person.objects.filter(email__role__name="ad",
email__role__group__type="area",
email__role__group__state="active").distinct())
@ -94,7 +94,7 @@ def wg_main(request, name, rev, tab):
latest_positions.append(p_pos[0])
else:
no_record.append(p)
info = {}
info['positions'] = latest_positions
info['pos_yes'] = filter(lambda x: x.pos_id == "yes", latest_positions)
info['pos_no'] = filter(lambda x: x.pos_id == "no", latest_positions)
@ -152,12 +152,16 @@ def _get_history(wg):
if e.type == "new_revision":
if charter_history:
charter = get_charter_for_revision(wg.charter, charter_history.rev)
group = get_group_for_revision(wg, charter_history.rev)
else:
charter = get_charter_for_revision(wg.charter, wg.charter.rev)
group = get_group_for_revision(wg, wg.charter.rev)
prev_charter = get_charter_for_revision(wg.charter, prev_revision(charter.rev))
results.append({'comment':e, 'info':info, 'date':e.time, 'group': wg,
prev_group = get_group_for_revision(wg, prev_revision(charter.rev))
results.append({'comment':e, 'info':info, 'date':e.time, 'group': group,
'charter': charter, 'prev_charter': prev_charter,
'prev_group': prev_group,
'txt_url': wg.charter.get_txt_url(),
'is_rev':True})
else:
@ -180,11 +184,13 @@ def _get_versions(charter, include_replaced=True):
for r in sorted(list(set(charter.history_set.values_list('rev', flat=True)))):
if r != "":
d = get_charter_for_revision(charter, r)
g = get_group_for_revision(charter.chartered_group, r)
if d.rev != charter.rev:
ov.append({"name":d.name, "rev":d.rev, "date":d.time})
ov.append({"name": "charter-ietf-%s" % g.acronym, "rev":d.rev, "date":d.time})
if charter.rev != "":
d = get_charter_for_revision(charter, charter.rev)
ov.append({"name": d.name, "rev": d.rev, "date":d.time})
g = get_group_for_revision(charter.chartered_group, charter.rev)
ov.append({"name": "charter-ietf-%s" % g.acronym, "rev": d.rev, "date":d.time})
return ov
def wg_ballot(request, name):

View file

@ -59,7 +59,7 @@ def submit(request, name):
e.type = "new_revision"
e.by = login
e.doc = charter
e.desc = "New version available: <b>%s</b>" % (charter.filename_with_rev())
e.desc = "New version available: <b>charter-ietf-%s-%s.txt</b>" % (wg.acronym, charter.rev)
e.save()
# Save file on disk

View file

@ -97,7 +97,7 @@ GROUP_EVENT_CHOICES = [
# misc group events
("added_comment", "Added comment"),
("changed_record", "Changed record metadata"),
("info_changed", "Changed WG metadata"),
]
class GroupEvent(models.Model):