diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 474025963..08dfe7c9e 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -12,6 +12,7 @@ from ietf.person.models import Email, Person from ietf.utils.admin import admin_link import datetime, os +import debug class StateType(models.Model): slug = models.CharField(primary_key=True, max_length=30) # draft, draft-iesg, charter, ... @@ -241,11 +242,23 @@ class Document(DocumentInfo): def related_that(self, relationship): """Return the documents that are source of relationship targeting self.""" - return Document.objects.filter(relateddocument__target__document=self, relateddocument__relationship=relationship) + if isinstance(relationship, str): + relationship = [ relationship ] + if isinstance(relationship, tuple): + relationship = list(relationship) + if not isinstance(relationship, list): + raise TypeError("Expected a string, tuple or list, received %s" % type(relationship)) + return Document.objects.filter(relateddocument__target__document=self, relateddocument__relationship__in=relationship) def related_that_doc(self, relationship): """Return the doc aliases that are target of relationship originating from self.""" - return DocAlias.objects.filter(relateddocument__source=self, relateddocument__relationship=relationship) + if isinstance(relationship, str): + relationship = [ relationship ] + if isinstance(relationship, tuple): + relationship = list(relationship) + if not isinstance(relationship, list): + raise TypeError("Expected a string, tuple or list, received %s" % type(relationship)) + return DocAlias.objects.filter(relateddocument__source=self, relateddocument__relationship__in=relationship) #TODO can/should this be a function instead of a property? Currently a view uses it as a property @property diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index bee19c160..9724acd68 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -47,20 +47,22 @@ from ietf.doc.models import * from ietf.doc.utils import * from ietf.utils.history import find_history_active_at from ietf.ietfauth.utils import * +from ietf.doc.views_status_change import RELATION_SLUGS as status_change_relationships +from ietf.wgcharter.utils import historic_milestones_for_charter def render_document_top(request, doc, tab, name): tabs = [] tabs.append(("Document", "document", urlreverse("doc_view", kwargs=dict(name=name)), True)) ballot = doc.latest_event(BallotDocEvent, type="created_ballot") - if doc.type_id in ("draft","conflrev"): + if doc.type_id in ("draft","conflrev", "statchg"): # if doc.in_ietf_process and doc.ietf_process.has_iesg_ballot: tabs.append(("IESG Evaluation Record", "ballot", urlreverse("doc_ballot", kwargs=dict(name=name)), ballot)) elif doc.type_id == "charter": tabs.append(("IESG Review", "ballot", urlreverse("doc_ballot", kwargs=dict(name=name)), ballot)) # FIXME: if doc.in_ietf_process and doc.ietf_process.has_iesg_ballot: - if doc.type_id != "conflrev": + if doc.type_id not in ["conflrev", "statchg"]: tabs.append(("IESG Writeups", "writeup", urlreverse("doc_writeup", kwargs=dict(name=name)), True)) tabs.append(("History", "history", urlreverse("doc_history", kwargs=dict(name=name)), True)) @@ -227,7 +229,9 @@ def document_main(request, name, rev=None): # submission submission = "" - if group.type_id == "individ": + if group is None: + submission = "unknown" + elif group.type_id == "individ": submission = "individual" elif group.type_id == "area" and doc.stream_id == "ietf": submission = "individual in %s area" % group.acronym @@ -271,6 +275,10 @@ def document_main(request, name, rev=None): # conflict reviews conflict_reviews = [d.name for d in doc.related_that("conflrev")] + status_change_docs = doc.related_that(status_change_relationships) + status_changes = [ rel for rel in status_change_docs if rel.get_state_slug() in ('appr-sent','appr-pend')] + proposed_status_changes = [ rel for rel in status_change_docs if rel.get_state_slug() in ('needshep','adrev','iesgeval','defer','appr-pr')] + # remaining actions actions = [] @@ -329,6 +337,8 @@ def document_main(request, name, rev=None): obsoletes=[prettify_std_name(d.name) for d in doc.related_that_doc("obs")], obsoleted_by=[prettify_std_name(d.canonical_name()) for d in doc.related_that("obs")], conflict_reviews=conflict_reviews, + status_changes=status_changes, + proposed_status_changes=proposed_status_changes, rfc_aliases=rfc_aliases, has_errata=doc.tags.filter(slug="errata"), published=doc.latest_event(type="published_rfc"), @@ -410,6 +420,40 @@ def document_main(request, name, rev=None): ), context_instance=RequestContext(request)) + if doc.type_id == "statchg": + filename = "%s-%s.txt" % (doc.canonical_name(), doc.rev) + pathname = os.path.join(settings.STATUS_CHANGE_PATH,filename) + + if doc.rev == "00" and not os.path.isfile(pathname): + # This could move to a template + content = "Status change text has not yet been proposed." + else: + content = get_document_content(filename, pathname, split=False) + + ballot_summary = None + if doc.get_state_slug() in ("iesgeval"): + ballot_summary = needed_ballot_positions(doc, doc.active_ballot().active_ad_positions().values()) + + if isinstance(doc,Document): + sorted_relations=doc.relateddocument_set.all().order_by('relationship__name') + elif isinstance(doc,DocHistory): + sorted_relations=doc.relateddochistory_set.all().order_by('relationship__name') + else: + sorted_relations=None + + return render_to_response("idrfc/document_status_change.html", + dict(doc=doc, + top=top, + content=content, + revisions=revisions, + snapshot=snapshot, + telechat=telechat, + ballot_summary=ballot_summary, + approved_states=('appr-pend','appr-sent'), + sorted_relations=sorted_relations, + ), + context_instance=RequestContext(request)) + raise Http404 @@ -420,7 +464,7 @@ def document_history(request, name): # pick up revisions from events diff_revisions = [] - diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review") + diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review") or name.startswith("status-change") if diffable: diff_documents = [ doc ] diff_documents.extend(Document.objects.filter(docalias__relateddocument__source=doc, docalias__relateddocument__relationship="replaces")) @@ -438,6 +482,9 @@ def document_history(request, name): elif name.startswith("conflict-review"): h = find_history_active_at(e.doc, e.time) url = settings.CONFLICT_REVIEW_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev)) + elif name.startswith("status-change"): + h = find_history_active_at(e.doc, e.time) + url = settings.STATUS_CHANGE_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev)) elif name.startswith("draft"): # rfcdiff tool has special support for IDs url = e.doc.name + "-" + e.rev diff --git a/ietf/templates/doc/document_ballot_content.html b/ietf/templates/doc/document_ballot_content.html index 1fc600111..da52897a0 100644 --- a/ietf/templates/doc/document_ballot_content.html +++ b/ietf/templates/doc/document_ballot_content.html @@ -10,10 +10,13 @@ {% if doc.type_id == "draft" or doc.type_id == "conflrev" %}
Telechat Date: | +
{% if not telechat %}Not on agenda of an IESG telechat{% else %}On agenda of {{ telechat.telechat_date|date:"Y-m-d" }} IESG telechat{% if doc.returning_item %} (returning item){% endif %}{% endif %}
-
-
{% if ballot_summary %}
({{ ballot_summary }})
{% endif %}
- {% endif %}
|
|||||||
Shepherding AD: | @@ -99,7 +100,7 @@ -||||||||
Shepherd Write-Up: | - + {% if shepherd_writeup %}Last changed {{ shepherd_writeup.time|date:"Y-m-d"}}{% else %}(None){% endif %} | diff --git a/ietf/templates/idrfc/document_charter.html b/ietf/templates/idrfc/document_charter.html index b4611a964..9a78432d9 100644 --- a/ietf/templates/idrfc/document_charter.html +++ b/ietf/templates/idrfc/document_charter.html @@ -40,7 +40,7 @@|||||||
Reason for chartering: | {% endif %} + {% if chartering == "rechartering" %}Reason for rechartering: | {% endif %} +{{ group.comments }} | +||||||
Responsible AD: | {{ doc.ad|default:"none" }} | diff --git a/ietf/templates/idrfc/document_status_change.html b/ietf/templates/idrfc/document_status_change.html index 4361e4433..56df091d8 100644 --- a/ietf/templates/idrfc/document_status_change.html +++ b/ietf/templates/idrfc/document_status_change.html @@ -1,4 +1,4 @@ -{% extends "idrfc/doc_main.html" %} +{% extends "base.html" %} {% load ietf_filters %} diff --git a/ietf/templates/idrfc/request_resurrect.html b/ietf/templates/idrfc/request_resurrect.html index caad47463..30a3c34cb 100644 --- a/ietf/templates/idrfc/request_resurrect.html +++ b/ietf/templates/idrfc/request_resurrect.html @@ -1,9 +1,9 @@ {% extends "base.html" %} -{% block title %}Request resurrect of {{ doc }}{% endblock %} +{% block title %}Request resurrection of {{ doc }}{% endblock %} {% block content %} -