Skip to content

Commit 68b05b6

Browse files
committed
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 e678659
1 parent e678659 commit 68b05b6

9 files changed

Lines changed: 96 additions & 24 deletions

ietf/doc/models.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ietf.utils.admin import admin_link
1313

1414
import datetime, os
15+
import debug
1516

1617
class StateType(models.Model):
1718
slug = models.CharField(primary_key=True, max_length=30) # draft, draft-iesg, charter, ...
@@ -241,11 +242,23 @@ def display_name(self):
241242

242243
def related_that(self, relationship):
243244
"""Return the documents that are source of relationship targeting self."""
244-
return Document.objects.filter(relateddocument__target__document=self, relateddocument__relationship=relationship)
245+
if isinstance(relationship, str):
246+
relationship = [ relationship ]
247+
if isinstance(relationship, tuple):
248+
relationship = list(relationship)
249+
if not isinstance(relationship, list):
250+
raise TypeError("Expected a string, tuple or list, received %s" % type(relationship))
251+
return Document.objects.filter(relateddocument__target__document=self, relateddocument__relationship__in=relationship)
245252

246253
def related_that_doc(self, relationship):
247254
"""Return the doc aliases that are target of relationship originating from self."""
248-
return DocAlias.objects.filter(relateddocument__source=self, relateddocument__relationship=relationship)
255+
if isinstance(relationship, str):
256+
relationship = [ relationship ]
257+
if isinstance(relationship, tuple):
258+
relationship = list(relationship)
259+
if not isinstance(relationship, list):
260+
raise TypeError("Expected a string, tuple or list, received %s" % type(relationship))
261+
return DocAlias.objects.filter(relateddocument__source=self, relateddocument__relationship__in=relationship)
249262

250263
#TODO can/should this be a function instead of a property? Currently a view uses it as a property
251264
@property

ietf/doc/views_doc.py

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,22 @@
4747
from ietf.doc.utils import *
4848
from ietf.utils.history import find_history_active_at
4949
from ietf.ietfauth.utils import *
50+
from ietf.doc.views_status_change import RELATION_SLUGS as status_change_relationships
51+
from ietf.wgcharter.utils import historic_milestones_for_charter
5052

5153
def render_document_top(request, doc, tab, name):
5254
tabs = []
5355
tabs.append(("Document", "document", urlreverse("doc_view", kwargs=dict(name=name)), True))
5456

5557
ballot = doc.latest_event(BallotDocEvent, type="created_ballot")
56-
if doc.type_id in ("draft","conflrev"):
58+
if doc.type_id in ("draft","conflrev", "statchg"):
5759
# if doc.in_ietf_process and doc.ietf_process.has_iesg_ballot:
5860
tabs.append(("IESG Evaluation Record", "ballot", urlreverse("doc_ballot", kwargs=dict(name=name)), ballot))
5961
elif doc.type_id == "charter":
6062
tabs.append(("IESG Review", "ballot", urlreverse("doc_ballot", kwargs=dict(name=name)), ballot))
6163

6264
# FIXME: if doc.in_ietf_process and doc.ietf_process.has_iesg_ballot:
63-
if doc.type_id != "conflrev":
65+
if doc.type_id not in ["conflrev", "statchg"]:
6466
tabs.append(("IESG Writeups", "writeup", urlreverse("doc_writeup", kwargs=dict(name=name)), True))
6567

6668
tabs.append(("History", "history", urlreverse("doc_history", kwargs=dict(name=name)), True))
@@ -227,7 +229,9 @@ def document_main(request, name, rev=None):
227229

228230
# submission
229231
submission = ""
230-
if group.type_id == "individ":
232+
if group is None:
233+
submission = "unknown"
234+
elif group.type_id == "individ":
231235
submission = "individual"
232236
elif group.type_id == "area" and doc.stream_id == "ietf":
233237
submission = "individual in %s area" % group.acronym
@@ -271,6 +275,10 @@ def document_main(request, name, rev=None):
271275
# conflict reviews
272276
conflict_reviews = [d.name for d in doc.related_that("conflrev")]
273277

278+
status_change_docs = doc.related_that(status_change_relationships)
279+
status_changes = [ rel for rel in status_change_docs if rel.get_state_slug() in ('appr-sent','appr-pend')]
280+
proposed_status_changes = [ rel for rel in status_change_docs if rel.get_state_slug() in ('needshep','adrev','iesgeval','defer','appr-pr')]
281+
274282
# remaining actions
275283
actions = []
276284

@@ -329,6 +337,8 @@ def document_main(request, name, rev=None):
329337
obsoletes=[prettify_std_name(d.name) for d in doc.related_that_doc("obs")],
330338
obsoleted_by=[prettify_std_name(d.canonical_name()) for d in doc.related_that("obs")],
331339
conflict_reviews=conflict_reviews,
340+
status_changes=status_changes,
341+
proposed_status_changes=proposed_status_changes,
332342
rfc_aliases=rfc_aliases,
333343
has_errata=doc.tags.filter(slug="errata"),
334344
published=doc.latest_event(type="published_rfc"),
@@ -410,6 +420,40 @@ def document_main(request, name, rev=None):
410420
),
411421
context_instance=RequestContext(request))
412422

423+
if doc.type_id == "statchg":
424+
filename = "%s-%s.txt" % (doc.canonical_name(), doc.rev)
425+
pathname = os.path.join(settings.STATUS_CHANGE_PATH,filename)
426+
427+
if doc.rev == "00" and not os.path.isfile(pathname):
428+
# This could move to a template
429+
content = "Status change text has not yet been proposed."
430+
else:
431+
content = get_document_content(filename, pathname, split=False)
432+
433+
ballot_summary = None
434+
if doc.get_state_slug() in ("iesgeval"):
435+
ballot_summary = needed_ballot_positions(doc, doc.active_ballot().active_ad_positions().values())
436+
437+
if isinstance(doc,Document):
438+
sorted_relations=doc.relateddocument_set.all().order_by('relationship__name')
439+
elif isinstance(doc,DocHistory):
440+
sorted_relations=doc.relateddochistory_set.all().order_by('relationship__name')
441+
else:
442+
sorted_relations=None
443+
444+
return render_to_response("idrfc/document_status_change.html",
445+
dict(doc=doc,
446+
top=top,
447+
content=content,
448+
revisions=revisions,
449+
snapshot=snapshot,
450+
telechat=telechat,
451+
ballot_summary=ballot_summary,
452+
approved_states=('appr-pend','appr-sent'),
453+
sorted_relations=sorted_relations,
454+
),
455+
context_instance=RequestContext(request))
456+
413457
raise Http404
414458

415459

@@ -420,7 +464,7 @@ def document_history(request, name):
420464
# pick up revisions from events
421465
diff_revisions = []
422466

423-
diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review")
467+
diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review") or name.startswith("status-change")
424468
if diffable:
425469
diff_documents = [ doc ]
426470
diff_documents.extend(Document.objects.filter(docalias__relateddocument__source=doc, docalias__relateddocument__relationship="replaces"))
@@ -438,6 +482,9 @@ def document_history(request, name):
438482
elif name.startswith("conflict-review"):
439483
h = find_history_active_at(e.doc, e.time)
440484
url = settings.CONFLICT_REVIEW_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev))
485+
elif name.startswith("status-change"):
486+
h = find_history_active_at(e.doc, e.time)
487+
url = settings.STATUS_CHANGE_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev))
441488
elif name.startswith("draft"):
442489
# rfcdiff tool has special support for IDs
443490
url = e.doc.name + "-" + e.rev

ietf/templates/doc/document_ballot_content.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
{% if doc.type_id == "draft" or doc.type_id == "conflrev" %}
1111
<div class="action">
1212
{% if deferred %}
13-
<a href="{% url doc_undefer_ballot name=doc.name %}">Undefer ballot</a>
13+
<div><a href="{% url doc_undefer_ballot name=doc.name %}">Undefer ballot</a></div>
1414
<div>Ballot deferred by {{ deferred.by }} on {{ deferred.time|date:"Y-m-d" }}.</div>
1515
{% else %}
16-
<a href="{% url doc_defer_ballot name=doc.name %}">Defer ballot</a>
16+
<div><a href="{% url doc_defer_ballot name=doc.name %}">Defer ballot</a></div>
17+
{% endif %}
18+
{% if user|has_role:"Secretariat" %}
19+
<div><a href="{% url doc_clear_ballot name=doc.name %}">Clear ballot</a></div>
1720
{% endif %}
1821
</div>
1922
{% endif %}

ietf/templates/doc/document_conflict_review.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% load ietf_filters %}
44

5-
{% block title %}{{ doc.canonical_name }}-{{ doc.rev }}{% endblock %}
5+
{% block title %}{{ doc.name }}-{{ doc.rev }}{% endblock %}
66

77
{% block pagehead %}
88
<link rel="stylesheet" type="text/css" href="/css/doc.css"></link>
@@ -24,7 +24,7 @@
2424
<div>
2525
{% if snapshot %}Snapshot of{% endif %}
2626
{% if doc.get_state_slug not in approved_states %}Proposed{% endif %}
27-
IESG Conflict Review for the {{conflictdoc.stream}} document: <a href="{% url doc_view name=conflictdoc.canonical_name %}">{{ conflictdoc.canonical_name }}-{{ conflictdoc.rev }}</a>
27+
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>
2828
</div>
2929

3030
<table id="metatable" width="100%">
@@ -42,25 +42,26 @@
4242

4343
{% endif %}
4444
</div>
45-
45+
</td>
46+
</tr>
4647
{% if not snapshot %}
47-
<div class="telechat">
48+
<tr>
49+
<td>Telechat Date:</td>
50+
<td>
4851
<a {% if not snapshot and user|has_role:"Area Director,Secretariat" and doc.get_state_slug not in approved_states %}
4952
class="editlink" href="{% url conflict_review_telechat_date name=doc.name %}"
5053
{%endif%} >
5154
{% 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 %}
5255
</a>
53-
</div>
54-
5556
{% if ballot_summary %}
5657
<div class="ballot-summary">
5758
({{ ballot_summary }})
5859
</div>
5960
{% endif %}
6061

61-
{% endif %}
6262
</td>
6363
</tr>
64+
{% endif %}
6465

6566
<tr>
6667
<td>Shepherding AD:</td>
@@ -99,7 +100,7 @@
99100

100101
</div>
101102

102-
<h3>Conflict Review for {{ conflictdoc.canonical_name }}-{{ conflictdoc.rev }}
103+
<h3>Conflict Review for {{ conflictdoc.name }}-{{ conflictdoc.rev }}
103104

104105
{% if not snapshot and user|has_role:"Area Director,Secretariat" and doc.get_state_slug != 'apprsent' %}
105106
<a class="edit" href="{% url conflict_review_submit name=doc.name %}">Change conflict review text</a>

ietf/templates/doc/document_draft.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
{% if updated_by %}<div>Updated by {{ updated_by|join:", "|urlize_ietf_docs }}</div>{% endif %}
2626
{% if obsoletes %}<div>Obsoletes {{ obsoletes|join:", "|urlize_ietf_docs }}</div>{% endif %}
2727
{% if updates %}<div>Updates {{ updates|join:", "|urlize_ietf_docs }}</div>{% endif %}
28+
{% if status_changes %}<div>Status changed by {{ status_changes|join:", "|urlize_ietf_docs }}</div>{% endif %}
29+
{% if proposed_status_changes %}<div>Proposed status changed by {{ proposed_status_changes|join:", "|urlize_ietf_docs }}</div>{% endif %}
2830
{% if rfc_aliases %}<div>Also Known As {{ rfc_aliases|join:", "|urlize_ietf_docs }}</div>{% endif %}
2931
{% if draft_name %}<div>Was <a href="/doc/{{ draft_name}}/">{{ draft_name }}</a> {% if submission %}({{ submission|safe }}){% endif %}</div>{% endif %}
3032
{% else %}
@@ -133,7 +135,7 @@
133135
<tr>
134136
<td>Shepherd Write-Up:</td>
135137
<td>
136-
<a {% if can_edit_shepherd_writeup %}class="editlink"{% endif %} href="{% url doc_managing_writeup acronym=group.acronym,name=doc.name %}">
138+
<a {% if can_edit_shepherd_writeup %}class="editlink"{% endif %} href="{% url doc_shepherd_writeup name=doc.name %}">
137139
{% if shepherd_writeup %}Last changed {{ shepherd_writeup.time|date:"Y-m-d"}}{% else %}(None){% endif %}
138140
</a>
139141
</td>

ietf/templates/idrfc/document_charter.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<td>
4141
<div>
4242
<a title="{{ doc.get_state.desc }}"
43-
{% if not snapshot and chartering and user|has_role:"Area Director,Secretariat" %}
43+
{% if not snapshot and user|has_role:"Area Director,Secretariat" %}
4444
class="editlink" href="{% url charter_change_state name=doc.name %}"
4545
{% endif %}>
4646
{{ doc.get_state.name }}
@@ -69,6 +69,14 @@
6969
</td>
7070
</tr>
7171

72+
{% if chartering and group.comments %}
73+
<tr>
74+
{% if chartering == "initial" %}<td>Reason for chartering:</td>{% endif %}
75+
{% if chartering == "rechartering" %}<td>Reason for rechartering:</td>{% endif %}
76+
<td>{{ group.comments }}</td>
77+
</tr>
78+
{% endif %}
79+
7280
<tr>
7381
<td>Responsible AD:</td>
7482
<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>

ietf/templates/idrfc/document_status_change.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "idrfc/doc_main.html" %}
1+
{% extends "base.html" %}
22

33
{% load ietf_filters %}
44

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% extends "base.html" %}
22

3-
{% block title %}Request resurrect of {{ doc }}{% endblock %}
3+
{% block title %}Request resurrection of {{ doc }}{% endblock %}
44

55
{% block content %}
6-
<h1>Request resurrect of {{ doc }}</h1>
6+
<h1>Request resurrection of {{ doc }}</h1>
77

88
<form action="" method="POST">
99
<p>Request resurrection of the Internet Draft {{ doc.file_tag }}?</p>
@@ -13,7 +13,7 @@ <h1>Request resurrect of {{ doc }}</h1>
1313

1414
<div class="actions">
1515
<a href="{{ back_url }}">Back</a>
16-
<input type="submit" value="Request resurrect"/>
16+
<input type="submit" value="Request resurrection"/>
1717
</div>
1818
</form>
1919
{% endblock %}

ietf/wginfo/tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ def test_edit_info(self):
217217
if "label" in line:
218218
label = line
219219
if 'class="errorlist"' in line:
220-
debug.show('label')
221-
debug.show('line')
222220
label = ""
223221
self.assertEquals(r.status_code, 302)
224222

0 commit comments

Comments
 (0)