Merged in fixes to the charter branch (r4345 - r4353) from olau@iola.dk.
- Legacy-Id: 4354
This commit is contained in:
commit
462aff53ad
|
@ -59,7 +59,7 @@ def needed_ballot_positions(doc, active_positions):
|
||||||
recuse = [p for p in active_positions if p and p.pos_id == "recuse"]
|
recuse = [p for p in active_positions if p and p.pos_id == "recuse"]
|
||||||
|
|
||||||
answer = []
|
answer = []
|
||||||
if yes < 1:
|
if len(yes) < 1:
|
||||||
answer.append("Needs a YES.")
|
answer.append("Needs a YES.")
|
||||||
if blocking:
|
if blocking:
|
||||||
if blocking:
|
if blocking:
|
||||||
|
@ -143,6 +143,28 @@ def get_chartering_type(doc):
|
||||||
|
|
||||||
return chartering
|
return chartering
|
||||||
|
|
||||||
|
def augment_events_with_revision(doc, events):
|
||||||
|
"""Take a set of events for doc and add a .rev attribute with the
|
||||||
|
revision they refer to by checking NewRevisionDocEvents."""
|
||||||
|
|
||||||
|
event_revisions = list(NewRevisionDocEvent.objects.filter(doc=doc).order_by('time', 'id').values('id', 'rev', 'time'))
|
||||||
|
|
||||||
|
cur_rev = doc.rev
|
||||||
|
if doc.get_state_slug() == "rfc":
|
||||||
|
cur_rev = "RFC"
|
||||||
|
|
||||||
|
for e in sorted(events, key=lambda e: (e.time, e.id), reverse=True):
|
||||||
|
while event_revisions and (e.time, e.id) < (event_revisions[-1]["time"], event_revisions[-1]["id"]):
|
||||||
|
event_revisions.pop()
|
||||||
|
|
||||||
|
if event_revisions:
|
||||||
|
cur_rev = event_revisions[-1]["rev"]
|
||||||
|
else:
|
||||||
|
cur_rev = "00"
|
||||||
|
|
||||||
|
e.rev = cur_rev
|
||||||
|
|
||||||
|
|
||||||
def augment_with_telechat_date(docs):
|
def augment_with_telechat_date(docs):
|
||||||
"""Add a telechat_date attribute to each document with the
|
"""Add a telechat_date attribute to each document with the
|
||||||
scheduled telechat or None if it's not scheduled."""
|
scheduled telechat or None if it's not scheduled."""
|
||||||
|
|
|
@ -50,7 +50,7 @@ from ietf.idrfc.models import RfcIndex, DraftVersions
|
||||||
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
|
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
|
||||||
from ietf.ietfworkflows.utils import get_full_info_for_draft
|
from ietf.ietfworkflows.utils import get_full_info_for_draft
|
||||||
from ietf.doc.models import *
|
from ietf.doc.models import *
|
||||||
from ietf.doc.utils import get_chartering_type, needed_ballot_positions, active_ballot_positions
|
from ietf.doc.utils import *
|
||||||
from ietf.utils.history import find_history_active_at
|
from ietf.utils.history import find_history_active_at
|
||||||
from ietf.ietfauth.decorators import has_role
|
from ietf.ietfauth.decorators import has_role
|
||||||
|
|
||||||
|
@ -96,10 +96,12 @@ def document_main(request, name, rev=None):
|
||||||
group = doc.group
|
group = doc.group
|
||||||
print group
|
print group
|
||||||
|
|
||||||
revisions = [ doc.rev ]
|
revisions = []
|
||||||
for h in doc.history_set.order_by("-time"):
|
for h in doc.history_set.order_by("time", "id"):
|
||||||
if h.rev and not h.rev in revisions:
|
if h.rev and not h.rev in revisions:
|
||||||
revisions.append(h.rev)
|
revisions.append(h.rev)
|
||||||
|
if not doc.rev in revisions:
|
||||||
|
revisions.append(doc.rev)
|
||||||
|
|
||||||
snapshot = False
|
snapshot = False
|
||||||
|
|
||||||
|
@ -192,23 +194,7 @@ def document_history(request, name):
|
||||||
# grab event history
|
# grab event history
|
||||||
events = doc.docevent_set.all().order_by("-time", "-id").select_related("by")
|
events = doc.docevent_set.all().order_by("-time", "-id").select_related("by")
|
||||||
|
|
||||||
# fill in revision numbers
|
augment_events_with_revision(doc, events)
|
||||||
event_revisions = list(NewRevisionDocEvent.objects.filter(doc=doc).order_by('time', 'id').values('rev', 'time'))
|
|
||||||
|
|
||||||
cur_rev = doc.rev
|
|
||||||
if doc.get_state_slug() == "rfc":
|
|
||||||
cur_rev = "RFC"
|
|
||||||
|
|
||||||
for e in events:
|
|
||||||
while event_revisions and e.time < event_revisions[-1]["time"]:
|
|
||||||
event_revisions.pop()
|
|
||||||
|
|
||||||
if event_revisions:
|
|
||||||
cur_rev = event_revisions[-1]["rev"]
|
|
||||||
else:
|
|
||||||
cur_rev = "00"
|
|
||||||
|
|
||||||
e.rev = cur_rev
|
|
||||||
|
|
||||||
return render_to_response("idrfc/document_history.html",
|
return render_to_response("idrfc/document_history.html",
|
||||||
dict(doc=doc,
|
dict(doc=doc,
|
||||||
|
@ -257,13 +243,21 @@ def document_writeup(request, name):
|
||||||
|
|
||||||
def document_ballot_content(request, doc, ballot_id, editable=True):
|
def document_ballot_content(request, doc, ballot_id, editable=True):
|
||||||
"""Render HTML string with content of ballot page."""
|
"""Render HTML string with content of ballot page."""
|
||||||
|
all_ballots = list(BallotDocEvent.objects.filter(doc=doc, type="created_ballot").order_by("time"))
|
||||||
|
augment_events_with_revision(doc, all_ballots)
|
||||||
|
|
||||||
|
ballot = None
|
||||||
if ballot_id != None:
|
if ballot_id != None:
|
||||||
ballot = doc.latest_event(BallotDocEvent, type="created_ballot", pk=ballot_id)
|
ballot_id = int(ballot_id)
|
||||||
else:
|
for b in all_ballots:
|
||||||
ballot = doc.latest_event(BallotDocEvent, type="created_ballot")
|
if b.id == ballot_id:
|
||||||
|
ballot = b
|
||||||
|
break
|
||||||
|
elif all_ballots:
|
||||||
|
ballot = all_ballots[-1]
|
||||||
|
|
||||||
if not ballot:
|
if not ballot:
|
||||||
raise Http404()
|
raise Http404
|
||||||
|
|
||||||
deferred = None
|
deferred = None
|
||||||
if doc.type_id == "draft" and doc.get_state_slug("draft-iesg") == "defer":
|
if doc.type_id == "draft" and doc.get_state_slug("draft-iesg") == "defer":
|
||||||
|
@ -316,7 +310,12 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
|
||||||
text_positions = [p for p in positions if p.discuss or p.comment]
|
text_positions = [p for p in positions if p.discuss or p.comment]
|
||||||
text_positions.sort(key=lambda p: (p.old_ad, p.ad.plain_name()))
|
text_positions.sort(key=lambda p: (p.old_ad, p.ad.plain_name()))
|
||||||
|
|
||||||
all_ballots = BallotDocEvent.objects.filter(doc=doc, type="created_ballot")
|
ballot_open = not BallotDocEvent.objects.filter(doc=doc,
|
||||||
|
type__in=("closed_ballot", "created_ballot"),
|
||||||
|
time__gt=ballot.time,
|
||||||
|
ballot_type=ballot.ballot_type)
|
||||||
|
if not ballot_open:
|
||||||
|
editable = False
|
||||||
|
|
||||||
return render_to_string("idrfc/document_ballot_content.html",
|
return render_to_string("idrfc/document_ballot_content.html",
|
||||||
dict(doc=doc,
|
dict(doc=doc,
|
||||||
|
@ -324,6 +323,7 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
|
||||||
position_groups=position_groups,
|
position_groups=position_groups,
|
||||||
text_positions=text_positions,
|
text_positions=text_positions,
|
||||||
editable=editable,
|
editable=editable,
|
||||||
|
ballot_open=ballot_open,
|
||||||
deferred=deferred,
|
deferred=deferred,
|
||||||
summary=summary,
|
summary=summary,
|
||||||
all_ballots=all_ballots,
|
all_ballots=all_ballots,
|
||||||
|
|
|
@ -39,15 +39,19 @@
|
||||||
|
|
||||||
{% if all_ballots and all_ballots|length > 1 %}
|
{% if all_ballots and all_ballots|length > 1 %}
|
||||||
<div class="other-ballots">
|
<div class="other-ballots">
|
||||||
Other ballots:
|
Available ballots:
|
||||||
{% for b in all_ballots %}
|
{% for b in all_ballots %}
|
||||||
<a{% if b != ballot %} href="{% url doc_ballot name=doc.name,ballot_id=b.pk %}"{% endif %}>{{ b.ballot_type.name }} ({{ b.time|date:"Y-m-d" }})</a>
|
<a{% if b != ballot %} href="{% url doc_ballot name=doc.name,ballot_id=b.pk %}"{% endif %}>{{ b.ballot_type.name }} ({{ b.rev }})</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2 style="margin-top:12px;">{{ ballot.ballot_type.question }}</h2>
|
<h2 style="margin-top:12px;">{{ ballot.ballot_type.question }}</h2>
|
||||||
|
|
||||||
|
{% if not ballot_open %}
|
||||||
|
<p>Note: This ballot was opened for revision {{ ballot.rev }} and is now closed.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<p>Summary: <i>{{ summary }}</i></p>
|
<p>Summary: <i>{{ summary }}</i></p>
|
||||||
|
|
||||||
{% for p in text_positions %}
|
{% for p in text_positions %}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
Snapshots:
|
Snapshots:
|
||||||
<span class="revisions">
|
<span class="revisions">
|
||||||
{% for rev in revisions %}
|
{% for rev in revisions %}
|
||||||
<a {% if rev != doc.rev %}href="{% url doc_view name=doc.name %}{% if not forloop.first %}{{ rev }}/{% endif %}"{% endif %}>{{ rev }}</a>
|
<a {% if rev != doc.rev %}href="{% url doc_view name=doc.name %}{% if not forloop.last %}{{ rev }}/{% endif %}"{% endif %}>{{ rev }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -245,9 +245,10 @@ def submit(request, name):
|
||||||
not_uploaded_yet = charter.rev.endswith("-00") and not os.path.exists(os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (charter.canonical_name(), charter.rev)))
|
not_uploaded_yet = charter.rev.endswith("-00") and not os.path.exists(os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (charter.canonical_name(), charter.rev)))
|
||||||
|
|
||||||
if not_uploaded_yet:
|
if not_uploaded_yet:
|
||||||
|
# this case is special - we recently chartered or rechartered and have no file yet
|
||||||
next_rev = charter.rev
|
next_rev = charter.rev
|
||||||
else:
|
else:
|
||||||
# Search history for possible collisions with abandoned efforts
|
# search history for possible collisions with abandoned efforts
|
||||||
prev_revs = list(charter.history_set.order_by('-time').values_list('rev', flat=True))
|
prev_revs = list(charter.history_set.order_by('-time').values_list('rev', flat=True))
|
||||||
next_rev = next_revision(charter.rev)
|
next_rev = next_revision(charter.rev)
|
||||||
while next_rev in prev_revs:
|
while next_rev in prev_revs:
|
||||||
|
@ -276,7 +277,17 @@ def submit(request, name):
|
||||||
return HttpResponseRedirect(reverse('doc_view', kwargs={'name': charter.name}))
|
return HttpResponseRedirect(reverse('doc_view', kwargs={'name': charter.name}))
|
||||||
else:
|
else:
|
||||||
init = { "content": ""}
|
init = { "content": ""}
|
||||||
filename = os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (charter.canonical_name(), charter.rev))
|
c = charter
|
||||||
|
|
||||||
|
if not_uploaded_yet:
|
||||||
|
# use text from last approved revision
|
||||||
|
last_approved = charter.rev.split("-")[0]
|
||||||
|
h = charter.history_set.filter(rev=last_approved).order_by("-time", "-id")
|
||||||
|
if h:
|
||||||
|
c = h[0]
|
||||||
|
|
||||||
|
filename = os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (c.canonical_name(), c.rev))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
init["content"] = f.read()
|
init["content"] = f.read()
|
||||||
|
@ -491,8 +502,8 @@ def approve(request, name):
|
||||||
raise Http404("Charter text %s" % filename)
|
raise Http404("Charter text %s" % filename)
|
||||||
|
|
||||||
e = NewRevisionDocEvent(doc=charter, by=login, type="new_revision")
|
e = NewRevisionDocEvent(doc=charter, by=login, type="new_revision")
|
||||||
e.desc = "New version available: <b>%s-%s.txt</b>" % (charter.canonical_name(), charter.rev)
|
|
||||||
e.rev = next_approved_revision(charter.rev)
|
e.rev = next_approved_revision(charter.rev)
|
||||||
|
e.desc = "New version available: <b>%s-%s.txt</b>" % (charter.canonical_name(), e.rev)
|
||||||
e.save()
|
e.save()
|
||||||
|
|
||||||
charter.rev = e.rev
|
charter.rev = e.rev
|
||||||
|
|
|
@ -21,7 +21,7 @@ from ietf.person.forms import EmailsField
|
||||||
|
|
||||||
class WGForm(forms.Form):
|
class WGForm(forms.Form):
|
||||||
name = forms.CharField(max_length=255, label="WG Name", required=True)
|
name = forms.CharField(max_length=255, label="WG Name", required=True)
|
||||||
acronym = forms.CharField(max_length=8, label="WG Acronym", required=True)
|
acronym = forms.CharField(max_length=10, label="WG Acronym", required=True)
|
||||||
chairs = EmailsField(label="WG Chairs", required=False)
|
chairs = EmailsField(label="WG Chairs", required=False)
|
||||||
secretaries = EmailsField(label="WG Secretaries", required=False)
|
secretaries = EmailsField(label="WG Secretaries", required=False)
|
||||||
techadv = EmailsField(label="WG Technical Advisors", required=False)
|
techadv = EmailsField(label="WG Technical Advisors", required=False)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
.m_h { font-family: arial; font-weight:bold;}
|
.m_h { font-family: arial; font-weight:bold;}
|
||||||
|
|
||||||
.snapshots { margin: 0.5em 0; }
|
.snapshots { margin: 0.5em 0; }
|
||||||
.snapshots .revisions a:first-child { font-weight: bold }
|
.snapshots .revisions a:last-child { font-weight: bold; }
|
||||||
|
|
||||||
.metabox .actions a { display: inline-block; margin-right: 0.4em; }
|
.metabox .actions a { display: inline-block; margin-right: 0.4em; }
|
||||||
.metabox .ballot-summary { font-style: italic; }
|
.metabox .ballot-summary { font-style: italic; }
|
||||||
|
|
Loading…
Reference in a new issue