Skip to content

Commit bb7fbd8

Browse files
committed
Merged [5794] to [5800] from olau@iola.dk:
* Skip IANA - Review Needed and Version Changed - Review Needed changes from IANA as it turns out that the Datatracker is the authoritative source on these states. Also improve logging so that the raw JSON from IANA is dumped, the parsed JSON on imported changes is dumped and we write to syslog before starting a sync script in the notification view. * Only add charter state change link when chartering, it doesn't make sense for an approved charter. Fixes ietf-tools#861. * Don't display group.comments on the charter document page. Apparently group.comments have been used by the Secretariat in the past for chartering comments, but it's not possible to edit the field and the whole thing doesn't make sense from a modelling perspective - a feature like this should probably use the note field on the charter. Fixes issue ietf-tools#1048. * Don't crash if an attachment has been created already, just reuse it - this case shouldn't actually happen, but apparently sometimes does, probably due to a concurrency issue * Add link to charter pages from the milestones editing page (besides the cancel button), fixes ietf-tools#1044. * Special-case proposed working groups with respect to milestones, they get the charter milestones on the WG charter page rather than the current set * Show approved milestones on /doc/charter-xyz/ page if the charter is approved instead of only showing proposed milestones for proposed charters - Legacy-Id: 5812 Note: SVN reference [5794] has been migrated to Git commit a603b8e Note: SVN reference [5800] has been migrated to Git commit 0f69f87
2 parents 718ff11 + 0f69f87 commit bb7fbd8

13 files changed

Lines changed: 88 additions & 58 deletions

File tree

ietf/bin/iana-changes-updates

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ while t < end:
5555
# requests if necessary
5656

5757
text = fetch_changes_json(settings.IANA_SYNC_CHANGES_URL, t, min(end, t + MAX_INTERVAL_ACCEPTED_BY_IANA))
58+
syslog.syslog("Retrieved the JSON: %s" % text)
59+
5860
changes = parse_changes_json(text)
5961
added_events, warnings = update_history_with_changes(changes, send_email=options.send_email)
6062

6163
for e in added_events:
62-
syslog.syslog("Added event for %s %s: %s" % (e.doc_id, e.time, e.desc))
64+
syslog.syslog("Added event for %s %s: %s (parsed json: %s)" % (e.doc_id, e.time, e.desc, e.json))
6365

6466
for w in warnings:
6567
syslog.syslog("WARNING: %s" % w)

ietf/idrfc/views_doc.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from ietf.utils.history import find_history_active_at
5656
from ietf.ietfauth.decorators import has_role
5757
from ietf.doc.views_status_change import RELATION_SLUGS as status_change_relationships
58+
from ietf.wgcharter.utils import historic_milestones_for_charter
5859

5960
def render_document_top(request, doc, tab, name):
6061
tabs = []
@@ -92,7 +93,7 @@ def document_main(request, name, rev=None):
9293
raise Http404()
9394
return document_main_idrfc(request, name, tab="document")
9495

95-
doc = get_object_or_404(Document, docalias__name=name)
96+
orig_doc = doc = get_object_or_404(Document, docalias__name=name)
9697
group = doc.group
9798
if doc.type_id == 'conflrev':
9899
conflictdoc = doc.relateddocument_set.get(relationship__slug='conflrev').target.document
@@ -153,9 +154,7 @@ def document_main(request, name, rev=None):
153154
chartering = get_chartering_type(doc)
154155

155156
# inject milestones from group
156-
milestones = None
157-
if chartering and not snapshot:
158-
milestones = doc.group.groupmilestone_set.filter(state="charter")
157+
milestones = historic_milestones_for_charter(orig_doc, doc.rev)
159158

160159
return render_to_response("idrfc/document_charter.html",
161160
dict(doc=doc,

ietf/liaisons/formsREDESIGN.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,13 @@ def save_attachments(self, instance):
280280
extension = ''
281281
written += 1
282282
name = instance.name() + ("-attachment-%s" % written)
283-
attach = Document.objects.create(
284-
title = self.data.get(title_key),
285-
type_id = "liaison",
283+
attach, _ = Document.objects.get_or_create(
286284
name = name,
287-
external_url = name + extension, # strictly speaking not necessary, but just for the time being ...
285+
defaults=dict(
286+
title = self.data.get(title_key),
287+
type_id = "liaison",
288+
external_url = name + extension, # strictly speaking not necessary, but just for the time being ...
289+
)
288290
)
289291
instance.attachments.add(attach)
290292
attach_file = open(os.path.join(settings.LIAISON_ATTACH_PATH, attach.name + extension), 'w')

ietf/sync/iana.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ def update_history_with_changes(changes, send_email=True):
169169
state = states[kind][c["state"]]
170170
state_type = "draft-iana-%s" % kind
171171

172+
if state.slug in ("need-rev", "changed"):
173+
# the Datatracker is the ultimate source of these
174+
# states, so skip them
175+
continue
176+
172177
e = StateDocEvent.objects.filter(type="changed_state", time=timestamp,
173178
state_type=state_type, state=state)
174179
if not e:
@@ -185,6 +190,8 @@ def update_history_with_changes(changes, send_email=True):
185190
e = add_state_change_event(doc, system, prev_state, state, timestamp)
186191

187192
if e:
193+
# for logging purposes
194+
e.json = c
188195
added_events.append(e)
189196

190197
if not StateDocEvent.objects.filter(doc=doc, time__gt=timestamp, state_type=state_type):

ietf/sync/tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def test_changes_sync(self):
4545
"state": "IANA Not OK",
4646
"type": "iana_review",
4747
},
48+
{
49+
"time": "2011-10-09 12:00:02",
50+
"doc": draft.name,
51+
"state": "IANA - Review Needed", # this should be skipped
52+
"type": "iana_review",
53+
},
4854
{
4955
"time": "2011-10-09 12:00:00",
5056
"doc": draft.name,

ietf/sync/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def runscript(name):
7878
out, _ = p.communicate()
7979
return (p.returncode, out)
8080

81+
import syslog
82+
syslog.syslog("Running sync script from notify view POST")
83+
8184
if notification == "protocols":
8285
failed, out = runscript("iana-protocols-updates")
8386

ietf/templates/idrfc/document_charter.html

Lines changed: 3 additions & 13 deletions
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 user|has_role:"Area Director,Secretariat" %}
43+
{% if not snapshot and chartering 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,14 +69,6 @@
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-
8072
<tr>
8173
<td>Responsible AD:</td>
8274
<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>
@@ -139,9 +131,8 @@ <h3>Charter {{ doc.canonical_name }}-{{ doc.rev }}
139131
</div>
140132
{% endif %}
141133

142-
{% if not snapshot and chartering %}
143-
<h3>Proposed Milestones
144-
{% if user|has_role:"Area Director,Secretariat" %}
134+
<h3>{% if chartering %}Proposed{% endif %} Milestones
135+
{% if not snapshot and user|has_role:"Area Director,Secretariat" %}
145136
<a class="edit" href="{% url wg_edit_charter_milestones acronym=doc.group.acronym %}">Edit charter milestones</a>
146137
{% endif %}
147138
</h3>
@@ -151,7 +142,6 @@ <h3>Proposed Milestones
151142
{% else %}
152143
<p>No milestones for charter found.</p>
153144
{% endif %}
154-
{% endif %}
155145

156146
{% endblock %}
157147

ietf/templates/wginfo/edit_milestones.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ <h1>{{ title }}</h1>
4141

4242
<noscript>This page depends on Javascript being enabled to work properly.</noscript>
4343

44+
<p>Links:
45+
<a href="{% url wg_charter acronym=group.acronym %}">{{ group.acronym }} {{ group.type.name }}</a>
46+
- <a href="{% url doc_view name=group.charter.canonical_name %}">{{ group.charter.canonical_name }}</a>
47+
</p>
48+
49+
4450
<p class="help">{% if forms %}Click a milestone to edit it.{% endif %}
4551

4652
{% if needs_review %}
@@ -53,7 +59,7 @@ <h1>{{ title }}</h1>
5359
{% if can_reset %}
5460
<p>
5561
You can <a href="{% url wg_reset_charter_milestones acronym=group.acronym %}">reset
56-
this list</a> to the currently in-use milestones for the {{ group.acronym }} {{ group.type.name }}.
62+
this list</a> to the milestones currently in use for the {{ group.acronym }} {{ group.type.name }}.
5763
</p>
5864
{% endif %}
5965

ietf/templates/wginfo/wg_charter.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,15 @@
162162
</p>
163163
{% endif %}
164164

165-
<h2>Charter for Working Group</h2>
165+
<h2>Charter for {% if wg.state_id == "proposed" %}Proposed{% endif %} Working Group</h2>
166166
<p>{{ wg.charter_text|escape|format_charter|safe }}</p>
167167

168-
<h2>Milestones
168+
<h2>{% if wg.state_id == "proposed" %}Proposed{% endif %} Milestones
169+
{% if wg.state_id != "proposed" %}
169170
{% if user|has_role:"Area Director,Secretariat" or is_chair %}
170171
<a class="button" href="{% url wg_edit_milestones acronym=wg.acronym %}">Add or edit milestones</a>
171172
{% endif %}
173+
{% endif %}
172174
</h2>
173175

174176
{% with wg.milestones as milestones %}{% include "wginfo/milestones.html" %}{% endwith %}

ietf/urls.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
admin.site.disable_action('delete_selected')
2323

2424

25-
from dajaxice.core import dajaxice_autodiscover
26-
dajaxice_autodiscover()
27-
2825
feeds = {
2926
'iesg-agenda': IESGAgenda,
3027
'last-call': InLastCall,
@@ -80,7 +77,6 @@
8077

8178
# Google webmaster tools verification url
8279
(r'^googlea30ad1dacffb5e5b.html', 'django.views.generic.simple.direct_to_template', { 'template': 'googlea30ad1dacffb5e5b.html' }),
83-
(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX, include('dajaxice.urls')),
8480
)
8581

8682
if settings.SERVER_MODE in ('development', 'test'):

0 commit comments

Comments
 (0)