Various fixes due to clear up tree conflicts and other bugs resulting from

the [5830] merge.
 - Legacy-Id: 5834
Note: SVN reference [5830] has been migrated to Git commit e678659b56
This commit is contained in:
Henrik Levkowetz 2013-07-16 14:02:43 +00:00
parent e678659b56
commit 68b05b609a
9 changed files with 96 additions and 24 deletions

View file

@ -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

View file

@ -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

View file

@ -10,10 +10,13 @@
{% if doc.type_id == "draft" or doc.type_id == "conflrev" %}
<div class="action">
{% if deferred %}
<a href="{% url doc_undefer_ballot name=doc.name %}">Undefer ballot</a>
<div><a href="{% url doc_undefer_ballot name=doc.name %}">Undefer ballot</a></div>
<div>Ballot deferred by {{ deferred.by }} on {{ deferred.time|date:"Y-m-d" }}.</div>
{% else %}
<a href="{% url doc_defer_ballot name=doc.name %}">Defer ballot</a>
<div><a href="{% url doc_defer_ballot name=doc.name %}">Defer ballot</a></div>
{% endif %}
{% if user|has_role:"Secretariat" %}
<div><a href="{% url doc_clear_ballot name=doc.name %}">Clear ballot</a></div>
{% endif %}
</div>
{% endif %}

View file

@ -2,7 +2,7 @@
{% load ietf_filters %}
{% block title %}{{ doc.canonical_name }}-{{ doc.rev }}{% endblock %}
{% block title %}{{ doc.name }}-{{ doc.rev }}{% endblock %}
{% block pagehead %}
<link rel="stylesheet" type="text/css" href="/css/doc.css"></link>
@ -24,7 +24,7 @@
<div>
{% if snapshot %}Snapshot of{% endif %}
{% if doc.get_state_slug not in approved_states %}Proposed{% endif %}
IESG Conflict Review for the {{conflictdoc.stream}} document: <a href="{% url doc_view name=conflictdoc.canonical_name %}">{{ conflictdoc.canonical_name }}-{{ conflictdoc.rev }}</a>
IESG Conflict Review for the {{conflictdoc.stream}} document: <a href="{% url doc_view name=conflictdoc.canonical_name %}">{{ conflictdoc.canonical_name }}{% if conflictdoc.get_state_slug != 'rfc' %}-{{ conflictdoc.rev }}{% endif %}</a>
</div>
<table id="metatable" width="100%">
@ -42,25 +42,26 @@
{% endif %}
</div>
</td>
</tr>
{% if not snapshot %}
<div class="telechat">
<tr>
<td>Telechat Date:</td>
<td>
<a {% if not snapshot and user|has_role:"Area Director,Secretariat" and doc.get_state_slug not in approved_states %}
class="editlink" href="{% url conflict_review_telechat_date name=doc.name %}"
{%endif%} >
{% 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 %}
</a>
</div>
{% if ballot_summary %}
<div class="ballot-summary">
({{ ballot_summary }})
</div>
{% endif %}
{% endif %}
</td>
</tr>
{% endif %}
<tr>
<td>Shepherding AD:</td>
@ -99,7 +100,7 @@
</div>
<h3>Conflict Review for {{ conflictdoc.canonical_name }}-{{ conflictdoc.rev }}
<h3>Conflict Review for {{ conflictdoc.name }}-{{ conflictdoc.rev }}
{% if not snapshot and user|has_role:"Area Director,Secretariat" and doc.get_state_slug != 'apprsent' %}
<a class="edit" href="{% url conflict_review_submit name=doc.name %}">Change conflict review text</a>

View file

@ -25,6 +25,8 @@
{% if updated_by %}<div>Updated by {{ updated_by|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if obsoletes %}<div>Obsoletes {{ obsoletes|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if updates %}<div>Updates {{ updates|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if status_changes %}<div>Status changed by {{ status_changes|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if proposed_status_changes %}<div>Proposed status changed by {{ proposed_status_changes|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if rfc_aliases %}<div>Also Known As {{ rfc_aliases|join:", "|urlize_ietf_docs }}</div>{% endif %}
{% if draft_name %}<div>Was <a href="/doc/{{ draft_name}}/">{{ draft_name }}</a> {% if submission %}({{ submission|safe }}){% endif %}</div>{% endif %}
{% else %}
@ -133,7 +135,7 @@
<tr>
<td>Shepherd Write-Up:</td>
<td>
<a {% if can_edit_shepherd_writeup %}class="editlink"{% endif %} href="{% url doc_managing_writeup acronym=group.acronym,name=doc.name %}">
<a {% if can_edit_shepherd_writeup %}class="editlink"{% endif %} href="{% url doc_shepherd_writeup name=doc.name %}">
{% if shepherd_writeup %}Last changed {{ shepherd_writeup.time|date:"Y-m-d"}}{% else %}(None){% endif %}
</a>
</td>

View file

@ -40,7 +40,7 @@
<td>
<div>
<a title="{{ doc.get_state.desc }}"
{% if not snapshot and chartering and user|has_role:"Area Director,Secretariat" %}
{% if not snapshot and user|has_role:"Area Director,Secretariat" %}
class="editlink" href="{% url charter_change_state name=doc.name %}"
{% endif %}>
{{ doc.get_state.name }}
@ -69,6 +69,14 @@
</td>
</tr>
{% if chartering and group.comments %}
<tr>
{% if chartering == "initial" %}<td>Reason for chartering:</td>{% endif %}
{% if chartering == "rechartering" %}<td>Reason for rechartering:</td>{% endif %}
<td>{{ group.comments }}</td>
</tr>
{% endif %}
<tr>
<td>Responsible AD:</td>
<td><a {% if request.user|has_role:"Area Director,Secretariat" %}class="editlink" href="{% url charter_edit_ad name=doc.name %}"{% endif %}>{{ doc.ad|default:"none" }}</a> </td>

View file

@ -1,4 +1,4 @@
{% extends "idrfc/doc_main.html" %}
{% extends "base.html" %}
{% load ietf_filters %}

View file

@ -1,9 +1,9 @@
{% extends "base.html" %}
{% block title %}Request resurrect of {{ doc }}{% endblock %}
{% block title %}Request resurrection of {{ doc }}{% endblock %}
{% block content %}
<h1>Request resurrect of {{ doc }}</h1>
<h1>Request resurrection of {{ doc }}</h1>
<form action="" method="POST">
<p>Request resurrection of the Internet Draft {{ doc.file_tag }}?</p>
@ -13,7 +13,7 @@
<div class="actions">
<a href="{{ back_url }}">Back</a>
<input type="submit" value="Request resurrect"/>
<input type="submit" value="Request resurrection"/>
</div>
</form>
{% endblock %}

View file

@ -217,8 +217,6 @@ class WgEditTestCase(django.test.TestCase):
if "label" in line:
label = line
if 'class="errorlist"' in line:
debug.show('label')
debug.show('line')
label = ""
self.assertEquals(r.status_code, 302)