Skip to content

Commit 848738b

Browse files
committed
Merged [4709] from housley@vigilsec.com:
Ability to fetch the IESG Telechat Agenda as a JSON object (agenda.json). - Legacy-Id: 4719 Note: SVN reference [4709] has been migrated to Git commit 92ce382
2 parents a13e506 + 92ce382 commit 848738b

2 files changed

Lines changed: 115 additions & 1 deletion

File tree

ietf/iesg/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
(r'^ann/(?P<cat>[^/]+)/$',views.wgdocs),
5353
(r'^agenda/$', views.agenda),
5454
(r'^agenda/agenda.txt$', views.agenda_txt),
55+
(r'^agenda/agenda.json$', views.agenda_json),
5556
(r'^agenda/scribe_template.html$', views.agenda_scribe_template),
5657
(r'^agenda/moderator_package.html$', views.agenda_moderator_package),
5758
(r'^agenda/agenda_package.txt$', views.agenda_package),

ietf/iesg/views.py

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@
3232
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3333
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434

35+
# Modified by Russ Housley on 6 July 2012 to add agenda_json and _agenda_json.
36+
3537
import codecs, re, os, glob
3638
import datetime
3739
import tarfile
3840

39-
from ietf.idtracker.models import IDInternal, InternetDraft,AreaGroup, Position, IESGLogin, Acronym
41+
from ietf.idtracker.models import IDInternal, InternetDraft, AreaGroup, Position, IESGLogin, Acronym
4042
from django.views.generic.list_detail import object_list
4143
from django.views.generic.simple import direct_to_template
4244
from django.views.decorators.vary import vary_on_cookie
@@ -45,6 +47,7 @@
4547
from django.template import RequestContext, Context, loader
4648
from django.shortcuts import render_to_response, get_object_or_404
4749
from django.conf import settings
50+
from django.utils import simplejson as json
4851
from django import forms
4952
from ietf.iesg.models import TelechatDates, TelechatAgendaItem, WGAction
5053
from ietf.idrfc.idrfc_wrapper import IdWrapper, RfcWrapper
@@ -193,6 +196,7 @@ def agenda_docs(date, next_agenda):
193196
from ietf.doc.models import TelechatDocEvent
194197

195198
matches = Document.objects.filter(docevent__telechatdocevent__telechat_date=date).distinct()
199+
matches = matches.filter(type__slug='draft')
196200

197201
docmatches = []
198202

@@ -219,6 +223,7 @@ def agenda_docs(date, next_agenda):
219223
def agenda_wg_actions(date):
220224
res = dict(("s%s%s%s" % (i, j, k), []) for i in range(2, 5) for j in range (1, 4) for k in range(1, 4))
221225
charters = Document.objects.filter(type="charter", docevent__telechatdocevent__telechat_date=date).select_related("group").distinct()
226+
charters = charters.filter(group__state__slug__in=["proposed","active"])
222227
for c in charters:
223228
if c.latest_event(TelechatDocEvent, type="scheduled_for_telechat").telechat_date != date:
224229
continue
@@ -234,6 +239,109 @@ def agenda_wg_actions(date):
234239
def agenda_management_issues(date):
235240
return TelechatAgendaItem.objects.filter(type=3).order_by('id')
236241

242+
def _agenda_json(request, date=None):
243+
if not date:
244+
date = TelechatDates.objects.all()[0].date1
245+
next_agenda = True
246+
else:
247+
y,m,d = date.split("-")
248+
date = datetime.date(int(y), int(m), int(d))
249+
next_agenda = None
250+
251+
data = {'telechat-date':str(date),
252+
'as-of':str(datetime.datetime.utcnow()),
253+
'sections':{}}
254+
data['sections']['1'] = {'title':"Administrivia"}
255+
data['sections']['1.1'] = {'title':"Roll Call"}
256+
data['sections']['1.2'] = {'title':"Bash the Agenda"}
257+
data['sections']['1.3'] = {'title':"Approval of the Minutes of Past Telechats"}
258+
data['sections']['1.4'] = {'title':"head List of Remaining Action Items from Last Telechat"}
259+
data['sections']['2'] = {'title':"Protocol Actions"}
260+
data['sections']['2.1'] = {'title':"WG Submissions"}
261+
data['sections']['2.1.1'] = {'title':"New Items", 'docs':[]}
262+
data['sections']['2.1.2'] = {'title':"Returning Items", 'docs':[]}
263+
data['sections']['2.2'] = {'title':"Individual Submissions"}
264+
data['sections']['2.2.1'] = {'title':"New Items", 'docs':[]}
265+
data['sections']['2.2.2'] = {'title':"Returning Items", 'docs':[]}
266+
data['sections']['3'] = {'title':"Document Actions"}
267+
data['sections']['3.1'] = {'title':"WG Submissions"}
268+
data['sections']['3.1.1'] = {'title':"New Items", 'docs':[]}
269+
data['sections']['3.1.2'] = {'title':"Returning Items", 'docs':[]}
270+
data['sections']['3.2'] = {'title':"Individual Submissions Via AD"}
271+
data['sections']['3.2.1'] = {'title':"New Items", 'docs':[]}
272+
data['sections']['3.2.2'] = {'title':"Returning Items", 'docs':[]}
273+
data['sections']['3.3'] = {'title':"IRTF and Independent Submission Stream Documents"}
274+
data['sections']['3.3.1'] = {'title':"New Items", 'docs':[]}
275+
data['sections']['3.3.2'] = {'title':"Returning Items", 'docs':[]}
276+
data['sections']['4'] = {'title':"Working Group Actions"}
277+
data['sections']['4.1'] = {'title':"WG Creation"}
278+
data['sections']['4.1.1'] = {'title':"Proposed for IETF Review", 'wgs':[]}
279+
data['sections']['4.1.2'] = {'title':"Proposed for Approval", 'wgs':[]}
280+
data['sections']['4.2'] = {'title':"WG Rechartering"}
281+
data['sections']['4.2.1'] = {'title':"Under Evaluation for IETF Review", 'wgs':[]}
282+
data['sections']['4.2.2'] = {'title':"Proposed for Approval", 'wgs':[]}
283+
data['sections']['5'] = {'title':"IAB News We Can Use"}
284+
data['sections']['6'] = {'title':"Management Issues"}
285+
data['sections']['7'] = {'title':"Working Group News"}
286+
287+
docs = agenda_docs(date, next_agenda)
288+
for section in docs.keys():
289+
# in case the document is in a state that does not have an agenda section
290+
if section != 's':
291+
s = str(".".join(list(section)[1:]))
292+
if s[0:1] == '4':
293+
# ignore these; not sure why they are included by agenda_docs
294+
pass
295+
else:
296+
if len(docs[section]) != 0:
297+
# If needed, add a "For Action" section to agenda
298+
if s[4:5] == '3':
299+
data['sections'][s] = {'title':"For Action", 'docs':[]}
300+
301+
for obj in docs[section]:
302+
d = obj['obj']
303+
docinfo = {'docname':d.canonical_name(),
304+
'rev':d.rev,
305+
'title':d.title,
306+
'intended-std-level':str(d.intended_std_level),
307+
'ad':d.ad.name}
308+
if d.rfc_number():
309+
docinfo['rfc-number'] = d.rfc_number()
310+
else:
311+
docinfo['rev'] = d.rev
312+
if d.note:
313+
docinfo['note'] = d.note
314+
defer = d.active_defer_event()
315+
if defer:
316+
docinfo['defer-by'] = defer.by.name
317+
docinfo['defer-at'] = str(defer.time)
318+
data['sections'][s]['docs'] += [docinfo, ]
319+
320+
wgs = agenda_wg_actions(date)
321+
for section in wgs.keys():
322+
# in case the charter is in a state that does not have an agenda section
323+
if section != 's':
324+
s = str(".".join(list(section)[1:]))
325+
if s[0:1] != '4':
326+
# ignore these; not sure why they are included by agenda_wg_actions
327+
pass
328+
else:
329+
if len(wgs[section]) != 0:
330+
for obj in wgs[section]:
331+
wg = obj['obj']
332+
wginfo = {'wgname':wg.name,
333+
'acronym':wg.acronym,
334+
'ad':wg.ad.name}
335+
data['sections'][s]['wgs'] += [wginfo, ]
336+
337+
mgmt = agenda_management_issues(date)
338+
num = 0
339+
for m in mgmt:
340+
num += 1
341+
data['sections']["6.%d" % num] = {'title':m.title}
342+
343+
return data
344+
237345
def _agenda_data(request, date=None):
238346
if not date:
239347
date = TelechatDates.objects.all()[0].date1
@@ -269,6 +377,11 @@ def agenda_txt(request):
269377
data = _agenda_data(request)
270378
return render_to_response("iesg/agenda.txt", data, context_instance=RequestContext(request), mimetype="text/plain")
271379

380+
def agenda_json(request):
381+
response = HttpResponse(mimetype='text/plain')
382+
response.write(json.dumps(_agenda_json(request), indent=2))
383+
return response
384+
272385
def agenda_scribe_template(request):
273386
date = TelechatDates.objects.all()[0].date1
274387
docs = agenda_docs(date, True)

0 commit comments

Comments
 (0)