def agenda_txt(request, date=None): data = agenda_data(date) return render_to_response("iesg/agenda.txt", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "domain": Site.objects.get_current().domain, }, context_instance=RequestContext(request), content_type="text/plain; charset=%s"%settings.DEFAULT_CHARSET)
def minutes(request, date): ''' This view shows a list of documents that were approved since the last telechat ''' # get the telechat previous to selected one y,m,d = date.split('-') current = datetime.date(int(y),int(m),int(d)) previous = TelechatDate.objects.filter(date__lt=current).order_by("-date")[0].date events = DocEvent.objects.filter(type='iesg_approved',time__gte=previous,time__lt=current,doc__type='draft') docs = [ e.doc for e in events ] pa_docs = [ doc for doc in docs if doc.intended_std_level.slug not in ('inf','exp','hist') ] da_docs = [ doc for doc in docs if doc.intended_std_level.slug in ('inf','exp','hist') ] agenda = agenda_data(date=date) # FIXME: this doesn't show other documents return render_to_response('telechat/minutes.html', { 'agenda': agenda, 'date': date, 'last_date': previous, 'pa_docs': pa_docs, 'da_docs': da_docs}, RequestContext(request, {}), )
def agenda_package(request, date=None): data = agenda_data(date) return render_to_response("iesg/agenda_package.txt", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "roll_call": data["sections"]["1.1"]["text"], "minutes": data["sections"]["1.3"]["text"], "management_items": [(num, section) for num, section in data["sections"].iteritems() if "6" < num < "7"], }, context_instance=RequestContext(request), content_type='text/plain')
def bash(request, date): agenda = agenda_data(date=date) return render_to_response('telechat/bash.html', { 'agenda': agenda, 'date': date}, RequestContext(request, {}), )
def agenda_txt(request, date=None): data = agenda_data(date) return render(request, "iesg/agenda.txt", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "domain": Site.objects.get_current().domain, }, content_type="text/plain; charset=%s" % settings.DEFAULT_CHARSET)
def roll_call(request, date): agenda = agenda_data(date=date) ads = Person.objects.filter(role__name='ad', role__group__state="active",role__group__type="area") sorted_ads = sorted(ads, key = lambda a: a.name_parts()[3]) return render_to_response('telechat/roll_call.html', { 'agenda': agenda, 'date': date, 'people':sorted_ads}, RequestContext(request, {}), )
def bash(request, date): agenda = agenda_data(date=date) return render( request, 'telechat/bash.html', { 'agenda': agenda, 'date': date }, )
def agenda_moderator_package(request, date=None): """Output telechat agenda with one page per section, with each document in its own section.""" data = agenda_data(date) def leaf_section(num, section): return not (num == "1" or "2" <= num < "5" and "docs" not in section or (num == "6" and "6.1" not in data["sections"])) # sort and prune non-leaf headlines sections = sorted((num, section) for num, section in data["sections"].iteritems() if leaf_section(num, section)) # add parents field to each section for num, s in sections: s["parents"] = [] split = num.split(".") for i in xrange(num.count(".")): parent_num = ".".join(split[:i + 1]) parent = data["sections"].get(parent_num) if parent: s["parents"].append((parent_num, parent)) # put each document in its own section flattened_sections = [] for num, s in sections: if "2" <= num < "5" and "docs" in s and s["docs"]: for i, d in enumerate(s["docs"], start=1): flattened_sections.append((num, { "title": s["title"] + " (%s of %s)" % (i, len(s["docs"])), "doc": d, "parents": s["parents"], })) else: flattened_sections.append((num, s)) # add ads data["sections"]["7"]["ads"] = sorted( Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area"), key=lambda p: p.name_parts()[3]) return render(request, "iesg/moderator_package.html", { "date": data["date"], "sections": flattened_sections, })
def agenda(request, date=None): data = agenda_data(date) if has_role(request.user, ["Area Director", "IAB Chair", "Secretariat"]): data["sections"]["1.1"]["title"] = data["sections"]["1.1"]["title"].replace("Roll call", '<a href="https://www.ietf.org/iesg/internal/rollcall.txt">Roll Call</a>') data["sections"]["1.3"]["title"] = data["sections"]["1.3"]["title"].replace("minutes", '<a href="https://www.ietf.org/iesg/internal/minutes.txt">Minutes</a>') request.session['ballot_edit_return_point'] = request.path_info return render_to_response("iesg/agenda.html", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "settings": settings, }, context_instance=RequestContext(request))
def management(request, date): ''' This view displays management issues and lets the user update the status ''' agenda = agenda_data(date=date) issues = TelechatAgendaItem.objects.filter(type=3).order_by('id') return render_to_response('telechat/management.html', { 'agenda': agenda, 'date': date, 'issues': issues}, RequestContext(request, {}), )
def agenda_scribe_template(request, date=None): data = agenda_data(date) sections = sorted((num, section) for num, section in data["sections"].iteritems() if "2" <= num < "4") appendix_docs = [] for num, section in sections: if "docs" in section: # why are we here including documents that have no discuss/comment? appendix_docs.extend(section["docs"]) return render_to_response("iesg/scribe_template.html", { "date": data["date"], "sections": sections, "appendix_docs": appendix_docs, "domain": Site.objects.get_current().domain, }, context_instance=RequestContext(request) )
def roll_call(request, date): agenda = agenda_data(date=date) ads = Person.objects.filter(role__name='ad', role__group__state="active", role__group__type="area") sorted_ads = sorted(ads, key=lambda a: a.name_parts()[3]) return render( request, 'telechat/roll_call.html', { 'agenda': agenda, 'date': date, 'people': sorted_ads }, )
def agenda_moderator_package(request, date=None): """Output telechat agenda with one page per section, with each document in its own section.""" data = agenda_data(date) def leaf_section(num, section): return not (num == "1" or "2" <= num < "5" and "docs" not in section or (num == "6" and "6.1" not in data["sections"])) # sort and prune non-leaf headlines sections = sorted((num, section) for num, section in data["sections"].iteritems() if leaf_section(num, section)) # add parents field to each section for num, s in sections: s["parents"] = [] split = num.split(".") for i in xrange(num.count(".")): parent_num = ".".join(split[:i + 1]) parent = data["sections"].get(parent_num) if parent: s["parents"].append((parent_num, parent)) # put each document in its own section flattened_sections = [] for num, s in sections: if "2" <= num < "5" and "docs" in s and s["docs"]: for i, d in enumerate(s["docs"], start=1): flattened_sections.append((num, { "title": s["title"] + " (%s of %s)" % (i, len(s["docs"])), "doc": d, "parents": s["parents"], })) else: flattened_sections.append((num, s)) # add ads data["sections"]["7"]["ads"] = sorted(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area"), key=lambda p: p.name_parts()[3]) return render_to_response("iesg/moderator_package.html", { "date": data["date"], "sections": flattened_sections, }, context_instance=RequestContext(request))
def management(request, date): ''' This view displays management issues and lets the user update the status ''' agenda = agenda_data(date=date) issues = TelechatAgendaItem.objects.filter(type=3).order_by('id') return render( request, 'telechat/management.html', { 'agenda': agenda, 'date': date, 'issues': issues }, )
def agenda_scribe_template(request, date=None): data = agenda_data(date) sections = sorted((num, section) for num, section in data["sections"].iteritems() if "2" <= num < "4") appendix_docs = [] for num, section in sections: if "docs" in section: # why are we here including documents that have no discuss/comment? appendix_docs.extend(section["docs"]) return render( request, "iesg/scribe_template.html", { "date": data["date"], "sections": sections, "appendix_docs": appendix_docs, "domain": Site.objects.get_current().domain, })
def doc(request, date): ''' This view redirects to doc_detail using the first document in the agenda or displays the message "No Documents" ''' agenda = agenda_data(date=date) doc = get_first_doc(agenda) if doc: return redirect('telechat_doc_detail', date=date, name=doc.name) else: return render_to_response('telechat/doc.html', { 'agenda': agenda, 'date': date, 'document': None}, RequestContext(request, {}), )
def agenda_package(request, date=None): data = agenda_data(date) return render(request, "iesg/agenda_package.txt", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "roll_call": data["sections"]["1.1"]["text"], "minutes": data["sections"]["1.3"]["text"], "management_items": [(num, section) for num, section in data["sections"].iteritems() if "6" < num < "7"], }, content_type='text/plain')
def doc_navigate(request, date, name, nav): ''' This view takes three arguments: date - the date of the Telechat name - the name of the current document being displayed nav - [next|previous] which direction the user wants to navigate in the list of docs The view retrieves the appropriate document and redirects to the doc view. ''' doc = get_object_or_404(Document, docalias__name=name) agenda = agenda_data(date=date) target = name docs = get_doc_list(agenda) index = docs.index(doc) if nav == 'next' and index < len(docs) - 1: target = docs[index + 1].name elif nav == 'previous' and index != 0: target = docs[index - 1].name return redirect('telechat_doc_detail', date=date, name=target)
def agenda(request, date=None): data = agenda_data(date) if has_role(request.user, ["Area Director", "IAB Chair", "Secretariat"]): data["sections"]["1.1"]["title"] = data["sections"]["1.1"][ "title"].replace( "Roll call", '<a href="https://www.ietf.org/iesg/internal/rollcall.txt">Roll Call</a>' ) data["sections"]["1.3"]["title"] = data["sections"]["1.3"][ "title"].replace( "minutes", '<a href="https://www.ietf.org/iesg/internal/minutes.txt">Minutes</a>' ) request.session['ballot_edit_return_point'] = request.path_info return render( request, "iesg/agenda.html", { "date": data["date"], "sections": sorted(data["sections"].iteritems()), "settings": settings, })
def minutes(request, date): ''' This view shows a list of documents that were approved since the last telechat ''' # get the telechat previous to selected one y, m, d = date.split('-') current = datetime.date(int(y), int(m), int(d)) previous = TelechatDate.objects.filter( date__lt=current).order_by("-date")[0].date events = DocEvent.objects.filter(type='iesg_approved', time__gte=previous, time__lt=current, doc__type='draft') docs = [e.doc for e in events] pa_docs = [ doc for doc in docs if doc.intended_std_level.slug not in ('inf', 'exp', 'hist') ] da_docs = [ doc for doc in docs if doc.intended_std_level.slug in ('inf', 'exp', 'hist') ] agenda = agenda_data(date=date) # FIXME: this doesn't show other documents return render( request, 'telechat/minutes.html', { 'agenda': agenda, 'date': date, 'last_date': previous, 'pa_docs': pa_docs, 'da_docs': da_docs }, )
def doc(request, date): ''' This view redirects to doc_detail using the first document in the agenda or displays the message "No Documents" ''' agenda = agenda_data(date=date) doc = get_first_doc(agenda) if doc: return redirect('ietf.secr.telechat.views.doc_detail', date=date, name=doc.name) else: return render( request, 'telechat/doc.html', { 'agenda': agenda, 'date': date, 'document': None }, )
def doc_navigate(request, date, name, nav): ''' This view takes three arguments: date - the date of the Telechat name - the name of the current document being displayed nav - [next|previous] which direction the user wants to navigate in the list of docs The view retrieves the appropriate document and redirects to the doc view. ''' doc = get_object_or_404(Document, docalias__name=name) agenda = agenda_data(date=date) target = name docs = get_doc_list(agenda) index = docs.index(doc) if nav == 'next' and index < len(docs) - 1: target = docs[index + 1].name elif nav == 'previous' and index != 0: target = docs[index - 1].name return redirect('ietf.secr.telechat.views.doc_detail', date=date, name=target)
def doc_detail(request, date, name): ''' This view displays the ballot information for the document, and lets the user make changes to ballot positions and document state. ''' doc = get_object_or_404(Document, docalias__name=name) if not is_doc_on_telechat(doc, date): messages.warning( request, 'Dcoument: {name} is not on the Telechat agenda for {date}'.format( name=doc.name, date=date)) return redirect('ietf.secr.telechat.views.doc', date=date) # As of Datatracker v4.32, Conflict Review (conflrev) Document Types can # be added to the Telechat agenda. If Document.type_id == draft use draft-iesg # for state type state_type = doc.type_id if doc.type_id == 'draft': state_type = 'draft-iesg' login = request.user.person if doc.active_ballot(): ballots = doc.active_ballot().active_ad_positions( ) # returns dict of ad:ballotpositiondocevent else: ballots = [] # setup form initials initial_ballot = [] open_positions = 0 for key in sorted(ballots, key=lambda a: a.name_parts()[3]): initial_ballot.append({ 'name': key.name, 'id': key.id, 'position': ballots[key].pos.slug if ballots[key] else None }) if ballots[key] and ballots[key].pos.slug == 'norecord': open_positions += 1 elif not ballots[key]: open_positions += 1 tags = doc.tags.filter(slug__in=TELECHAT_TAGS) tag = tags[0].pk if tags else None writeup = get_doc_writeup(doc) initial_state = {'state': doc.get_state(state_type).pk, 'substate': tag} # need to use curry here to pass custom variable to form init if doc.active_ballot(): ballot_type = doc.active_ballot().ballot_type else: ballot_type = BallotType.objects.get(doc_type='draft') BallotFormset = formset_factory(BallotForm, extra=0) BallotFormset.form.__init__ = curry(BallotForm.__init__, ballot_type=ballot_type) agenda = agenda_data(date=date) header = get_section_header(doc, agenda) # nav button logic doc_list = get_doc_list(agenda) nav_start = nav_end = False if doc == doc_list[0]: nav_start = True if doc == doc_list[-1]: nav_end = True if request.method == 'POST': button_text = request.POST.get('submit', '') # logic from doc/views_ballot.py EditPosition if button_text == 'update_ballot': formset = BallotFormset(request.POST, initial=initial_ballot) state_form = ChangeStateForm(initial=initial_state) has_changed = False for form in formset.forms: if form.is_valid() and form.changed_data: # create new BallotPositionDocEvent clean = form.cleaned_data ad = Person.objects.get(id=clean['id']) pos = BallotPositionDocEvent(doc=doc, rev=doc.rev, by=login) pos.type = "changed_ballot_position" pos.ad = ad pos.ballot = doc.latest_event(BallotDocEvent, type="created_ballot") pos.pos = clean['position'] if form.initial['position'] == None: pos.desc = '[Ballot Position Update] New position, %s, has been recorded for %s by %s' % ( pos.pos.name, ad.name, login.name) else: pos.desc = '[Ballot Position Update] Position for %s has been changed to %s by %s' % ( ad.name, pos.pos.name, login.name) pos.save() has_changed = True if has_changed: messages.success(request, 'Ballot position changed.') return redirect('ietf.secr.telechat.views.doc_detail', date=date, name=name) # logic from doc/views_draft.py change_state elif button_text == 'update_state': formset = BallotFormset(initial=initial_ballot) state_form = ChangeStateForm(request.POST, initial=initial_state) if state_form.is_valid(): prev_state = doc.get_state(state_type) new_state = state_form.cleaned_data['state'] tag = state_form.cleaned_data['substate'] # tag handling is a bit awkward since the UI still works # as if IESG tags are a substate prev_tags = doc.tags.filter(slug__in=TELECHAT_TAGS) new_tags = [tag] if tag else [] if state_form.changed_data: if 'state' in state_form.changed_data: doc.set_state(new_state) if 'substate' in state_form.changed_data: doc.tags.remove(*prev_tags) doc.tags.add(*new_tags) e = add_state_change_event(doc, login, prev_state, new_state, prev_tags=prev_tags, new_tags=new_tags) if e: doc.save_with_history([e]) email_state_changed(request, doc, e.desc, 'doc_state_edited') if new_state.slug == "lc-req": request_last_call(request, doc) messages.success(request, 'Document state updated') return redirect('ietf.secr.telechat.views.doc_detail', date=date, name=name) else: formset = BallotFormset(initial=initial_ballot) state_form = ChangeStateForm(initial=initial_state) # if this is a conflict review document add referenced document if doc.type_id == 'conflrev': conflictdoc = doc.relateddocument_set.get( relationship__slug='conflrev').target.document else: conflictdoc = None return render( request, 'telechat/doc.html', { 'ballot_type': ballot_type, 'date': date, 'document': doc, 'conflictdoc': conflictdoc, 'agenda': agenda, 'formset': formset, 'header': header, 'open_positions': open_positions, 'state_form': state_form, 'writeup': writeup, 'nav_start': nav_start, 'nav_end': nav_end }, )
def agenda_json(request, date=None): data = agenda_data(date) res = { "telechat-date": str(data["date"]), "as-of": str(datetime.datetime.utcnow()), "page-counts": telechat_page_count(get_agenda_date(date))._asdict(), "sections": {}, } for num, section in data["sections"].iteritems(): s = res["sections"][num] = { "title": section["title"], } if "docs" not in section: continue docs = section["docs"] if "4" <= num < "5": # charters s["wgs"] = [] for doc in docs: wginfo = { 'docname': doc.canonical_name(), 'rev': doc.rev, 'wgname': doc.group.name, 'acronym': doc.group.acronym, 'ad': doc.group.ad_role().person.name if doc.group.ad_role() else None, } # consider moving the charters to "docs" like the other documents s['wgs'].append(wginfo) else: # other documents s["docs"] = [] for doc in docs: docinfo = { 'docname': doc.canonical_name(), 'title': doc.title, 'ad': doc.ad.name if doc.ad else None, } if doc.note: docinfo['note'] = doc.note defer = doc.active_defer_event() if defer: docinfo['defer-by'] = defer.by.name docinfo['defer-at'] = str(defer.time) if doc.type_id == "draft": docinfo['rev'] = doc.rev docinfo['intended-std-level'] = str(doc.intended_std_level) if doc.rfc_number(): docinfo['rfc-number'] = doc.rfc_number() iana_state = doc.get_state("draft-iana-review") if iana_state and iana_state.slug in ("not-ok", "changed", "need-rev"): docinfo['iana-review-state'] = str(iana_state) if doc.get_state_slug("draft-iesg") == "lc": e = doc.latest_event(LastCallDocEvent, type="sent_last_call") if e: docinfo['lastcall-expires'] = e.expires.strftime( "%Y-%m-%d") docinfo['consensus'] = None e = doc.latest_event(ConsensusDocEvent, type="changed_consensus") if e: docinfo['consensus'] = e.consensus docinfo['rfc-ed-note'] = doc.has_rfc_editor_note() elif doc.type_id == 'conflrev': docinfo['rev'] = doc.rev td = doc.relateddocument_set.get( relationship__slug='conflrev').target.document docinfo['target-docname'] = td.canonical_name() docinfo['target-title'] = td.title docinfo['target-rev'] = td.rev docinfo['intended-std-level'] = str(td.intended_std_level) docinfo['stream'] = str(td.stream) else: # XXX check this -- is there nothing to set for # all other documents here? pass s["docs"].append(docinfo) return HttpResponse(json.dumps(res, indent=2), content_type='text/plain')
def doc_detail(request, date, name): ''' This view displays the ballot information for the document, and lets the user make changes to ballot positions and document state. ''' doc = get_object_or_404(Document, docalias__name=name) # As of Datatracker v4.32, Conflict Review (conflrev) Document Types can # be added to the Telechat agenda. If Document.type_id == draft use draft-iesg # for state type state_type = doc.type_id if doc.type_id == 'draft': state_type = 'draft-iesg' login = request.user.person if doc.active_ballot(): ballots = doc.active_ballot().active_ad_positions() # returns dict of ad:ballotpositiondocevent else: ballots = [] # setup form initials initial_ballot = [] open_positions = 0 for key in sorted(ballots, key = lambda a: a.name_parts()[3]): initial_ballot.append({'name':key.name,'id':key.id,'position':ballots[key].pos.slug if ballots[key] else None}) if ballots[key] and ballots[key].pos.slug == 'norecord': open_positions += 1 elif not ballots[key]: open_positions += 1 tags = doc.tags.filter(slug__in=TELECHAT_TAGS) tag = tags[0].pk if tags else None writeup = get_doc_writeup(doc) initial_state = {'state':doc.get_state(state_type).pk, 'substate':tag} BallotFormset = formset_factory(BallotForm, extra=0) agenda = agenda_data(date=date) header = get_section_header(doc, agenda) # nav button logic doc_list = get_doc_list(agenda) nav_start = nav_end = False if doc == doc_list[0]: nav_start = True if doc == doc_list[-1]: nav_end = True if request.method == 'POST': button_text = request.POST.get('submit', '') # logic from doc/views_ballot.py EditPosition if button_text == 'update_ballot': formset = BallotFormset(request.POST, initial=initial_ballot) state_form = ChangeStateForm(initial=initial_state) has_changed = False for form in formset.forms: if form.is_valid() and form.changed_data: # create new BallotPositionDocEvent clean = form.cleaned_data ad = Person.objects.get(id=clean['id']) pos = BallotPositionDocEvent(doc=doc,by=login) pos.type = "changed_ballot_position" pos.ad = ad pos.ballot = doc.latest_event(BallotDocEvent, type="created_ballot") pos.pos = clean['position'] if form.initial['position'] == None: pos.desc = '[Ballot Position Update] New position, %s, has been recorded for %s by %s' % (pos.pos.name, ad.name, login.name) else: pos.desc = '[Ballot Position Update] Position for %s has been changed to %s by %s' % (ad.name, pos.pos.name, login.name) pos.save() has_changed = True if has_changed: messages.success(request,'Ballot position changed.') return redirect('telechat_doc_detail', date=date, name=name) # logic from doc/views_draft.py change_state elif button_text == 'update_state': formset = BallotFormset(initial=initial_ballot) state_form = ChangeStateForm(request.POST, initial=initial_state) if state_form.is_valid(): prev_state = doc.get_state(state_type) new_state = state_form.cleaned_data['state'] tag = state_form.cleaned_data['substate'] # tag handling is a bit awkward since the UI still works # as if IESG tags are a substate prev_tags = doc.tags.filter(slug__in=TELECHAT_TAGS) new_tags = [tag] if tag else [] if state_form.changed_data: save_document_in_history(doc) if 'state' in state_form.changed_data: doc.set_state(new_state) if 'substate' in state_form.changed_data: doc.tags.remove(*prev_tags) doc.tags.add(*new_tags) e = add_state_change_event(doc, login, prev_state, new_state, prev_tags=prev_tags, new_tags=new_tags) doc.time = (e and e.time) or datetime.datetime.now() doc.save() email_state_changed(request, doc, e.desc, 'doc_state_edited') if new_state.slug == "lc-req": request_last_call(request, doc) messages.success(request,'Document state updated') return redirect('telechat_doc_detail', date=date, name=name) else: formset = BallotFormset(initial=initial_ballot) state_form = ChangeStateForm(initial=initial_state) # if this is a conflict review document add referenced document if doc.type_id == 'conflrev': conflictdoc = doc.relateddocument_set.get(relationship__slug='conflrev').target.document else: conflictdoc = None return render_to_response('telechat/doc.html', { 'date': date, 'document': doc, 'conflictdoc': conflictdoc, 'agenda': agenda, 'formset': formset, 'header': header, 'open_positions': open_positions, 'state_form': state_form, 'writeup': writeup, 'nav_start': nav_start, 'nav_end': nav_end}, RequestContext(request, {}), )
def agenda_json(request, date=None): data = agenda_data(date) res = { "telechat-date": str(data["date"]), "as-of": str(datetime.datetime.utcnow()), "page-counts": telechat_page_count(get_agenda_date(date))._asdict(), "sections": {}, } for num, section in data["sections"].iteritems(): s = res["sections"][num] = { "title": section["title"], } if "docs" not in section: continue docs = section["docs"] if "4" <= num < "5": # charters s["wgs"] = [] for doc in docs: wginfo = { 'docname': doc.canonical_name(), 'rev': doc.rev, 'wgname': doc.group.name, 'acronym': doc.group.acronym, 'ad': doc.group.ad_role().person.name if doc.group.ad_role() else None, } # consider moving the charters to "docs" like the other documents s['wgs'].append(wginfo) else: # other documents s["docs"] = [] for doc in docs: docinfo = { 'docname':doc.canonical_name(), 'title':doc.title, 'ad':doc.ad.name if doc.ad else None, } if doc.note: docinfo['note'] = doc.note defer = doc.active_defer_event() if defer: docinfo['defer-by'] = defer.by.name docinfo['defer-at'] = str(defer.time) if doc.type_id == "draft": docinfo['rev'] = doc.rev docinfo['intended-std-level'] = str(doc.intended_std_level) if doc.rfc_number(): docinfo['rfc-number'] = doc.rfc_number() iana_state = doc.get_state("draft-iana-review") if iana_state and iana_state.slug in ("not-ok", "changed", "need-rev"): docinfo['iana-review-state'] = str(iana_state) if doc.get_state_slug("draft-iesg") == "lc": e = doc.latest_event(LastCallDocEvent, type="sent_last_call") if e: docinfo['lastcall-expires'] = e.expires.strftime("%Y-%m-%d") docinfo['consensus'] = None e = doc.latest_event(ConsensusDocEvent, type="changed_consensus") if e: docinfo['consensus'] = e.consensus elif doc.type_id == 'conflrev': docinfo['rev'] = doc.rev td = doc.relateddocument_set.get(relationship__slug='conflrev').target.document docinfo['target-docname'] = td.canonical_name() docinfo['target-title'] = td.title docinfo['target-rev'] = td.rev docinfo['intended-std-level'] = str(td.intended_std_level) docinfo['stream'] = str(td.stream) else: # XXX check this -- is there nothing to set for # all other documents here? pass s["docs"].append(docinfo) return HttpResponse(json.dumps(res, indent=2), content_type='text/plain')
def test_fill_in_agenda_docs(self): draft = self.telechat_docs["ietf_draft"] statchg = self.telechat_docs["statchg"] conflrev = self.telechat_docs["conflrev"] charter = self.telechat_docs["charter"] # put on agenda date = datetime.date.today() + datetime.timedelta(days=50) TelechatDate.objects.create(date=date) telechat_event = TelechatDocEvent.objects.create( type="scheduled_for_telechat", doc=draft, by=Person.objects.get(name="Aread Irector"), telechat_date=date, returning_item=False) date_str = date.isoformat() # 2.1 protocol WG submissions draft.intended_std_level_id = "ps" draft.group = Group.objects.get(acronym="mars") draft.save() draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.3"]["docs"]) # 2.2 protocol individual submissions draft.group = Group.objects.get(type="individ") draft.save() draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.3"]["docs"]) # 3.1 document WG submissions draft.intended_std_level_id = "inf" draft.group = Group.objects.get(acronym="mars") draft.save() draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.3"]["docs"]) # 3.2 document individual submissions draft.group = Group.objects.get(type="individ") draft.save() draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.3"]["docs"]) # 2.3 protocol status changes telechat_event.doc = statchg telechat_event.save() relation = RelatedDocument.objects.create( source=statchg, target=DocAlias.objects.filter(name__startswith='rfc', document__std_level="ps")[0], relationship_id="tohist") statchg.group = Group.objects.get(acronym="mars") statchg.save() statchg.set_state(State.objects.get(type="statchg", slug="iesgeval")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() statchg.set_state(State.objects.get(type="statchg", slug="adrev")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.3"]["docs"]) # 3.3 document status changes relation.target = DocAlias.objects.filter(name__startswith='rfc', document__std_level="inf")[0] relation.save() statchg.group = Group.objects.get(acronym="mars") statchg.save() statchg.set_state(State.objects.get(type="statchg", slug="iesgeval")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() statchg.set_state(State.objects.get(type="statchg", slug="adrev")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.3"]["docs"]) # 3.4 IRTF/ISE conflict reviews telechat_event.doc = conflrev telechat_event.save() conflrev.group = Group.objects.get(acronym="mars") conflrev.save() conflrev.set_state(State.objects.get(type="conflrev", slug="iesgeval")) self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() conflrev.set_state(State.objects.get(type="conflrev", slug="needshep")) self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.3"]["docs"]) # 4 WGs telechat_event.doc = charter telechat_event.save() charter.group = Group.objects.get(acronym="mars") charter.save() charter.group.state_id = "bof" charter.group.save() charter.set_state(State.objects.get(type="charter", slug="infrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.1.1"]["docs"]) charter.set_state(State.objects.get(type="charter", slug="iesgrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.1.2"]["docs"]) charter.group.state_id = "active" charter.group.save() charter.set_state(State.objects.get(type="charter", slug="infrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.2.1"]["docs"]) charter.set_state(State.objects.get(type="charter", slug="iesgrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.2.2"]["docs"])
def test_fill_in_agenda_docs(self): draft = self.telechat_docs["ietf_draft"] statchg = self.telechat_docs["statchg"] conflrev = self.telechat_docs["conflrev"] charter = self.telechat_docs["charter"] # put on agenda date = datetime.date.today() + datetime.timedelta(days=50) TelechatDate.objects.create(date=date) telechat_event = TelechatDocEvent.objects.create( type="scheduled_for_telechat", doc=draft, rev=draft.rev, by=Person.objects.get(name="AreaĆ° Irector"), telechat_date=date, returning_item=False) date_str = date.isoformat() # 2.1 protocol WG submissions draft.intended_std_level_id = "ps" draft.group = Group.objects.get(acronym="mars") draft.save_with_history([DocEvent.objects.create(doc=draft, rev=draft.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.1.3"]["docs"]) # 2.2 protocol individual submissions draft.group = Group.objects.get(type="individ") draft.save_with_history([DocEvent.objects.create(doc=draft, rev=draft.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["2.2.3"]["docs"]) # 3.1 document WG submissions draft.intended_std_level_id = "inf" draft.group = Group.objects.get(acronym="mars") draft.save_with_history([DocEvent.objects.create(doc=draft, rev=draft.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.1.3"]["docs"]) # 3.2 document individual submissions draft.group = Group.objects.get(type="individ") draft.save_with_history([DocEvent.objects.create(doc=draft, rev=draft.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req")) self.assertTrue(draft in agenda_data(date_str)["sections"]["3.2.3"]["docs"]) # 2.3 protocol status changes telechat_event.doc = statchg telechat_event.save() relation = RelatedDocument.objects.create( source=statchg, target=DocAlias.objects.filter(name__startswith='rfc', document__std_level="ps")[0], relationship_id="tohist") statchg.group = Group.objects.get(acronym="mars") statchg.save_with_history([DocEvent.objects.create(doc=statchg, rev=statchg.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) statchg.set_state(State.objects.get(type="statchg", slug="iesgeval")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() statchg.set_state(State.objects.get(type="statchg", slug="adrev")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["2.3.3"]["docs"]) # 3.3 document status changes relation.target = DocAlias.objects.filter(name__startswith='rfc', document__std_level="inf")[0] relation.save() statchg.group = Group.objects.get(acronym="mars") statchg.save_with_history([DocEvent.objects.create(doc=statchg, rev=statchg.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) statchg.set_state(State.objects.get(type="statchg", slug="iesgeval")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() statchg.set_state(State.objects.get(type="statchg", slug="adrev")) self.assertTrue(statchg in agenda_data(date_str)["sections"]["3.3.3"]["docs"]) # 3.4 IRTF/ISE conflict reviews telechat_event.doc = conflrev telechat_event.save() conflrev.group = Group.objects.get(acronym="mars") conflrev.save_with_history([DocEvent.objects.create(doc=conflrev, rev=conflrev.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) conflrev.set_state(State.objects.get(type="conflrev", slug="iesgeval")) self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.1"]["docs"]) telechat_event.returning_item = True telechat_event.save() self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.2"]["docs"]) telechat_event.returning_item = False telechat_event.save() conflrev.set_state(State.objects.get(type="conflrev", slug="needshep")) self.assertTrue(conflrev in agenda_data(date_str)["sections"]["3.4.3"]["docs"]) # 4 WGs telechat_event.doc = charter telechat_event.save() charter.group = Group.objects.get(acronym="mars") charter.save_with_history([DocEvent.objects.create(doc=charter, rev=charter.rev, type="changed_group", by=Person.objects.get(user__username="******"), desc="Test")]) charter.group.state_id = "bof" charter.group.save() charter.set_state(State.objects.get(type="charter", slug="infrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.1.1"]["docs"]) charter.set_state(State.objects.get(type="charter", slug="iesgrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.1.2"]["docs"]) charter.group.state_id = "active" charter.group.save() charter.set_state(State.objects.get(type="charter", slug="infrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.2.1"]["docs"]) charter.set_state(State.objects.get(type="charter", slug="iesgrev")) self.assertTrue(charter in agenda_data(date_str)["sections"]["4.2.2"]["docs"])