def telechat_date(request, name): doc = get_object_or_404(Document, type="conflrev", name=name) login = request.user.get_profile() e = doc.latest_event(TelechatDocEvent, type="scheduled_for_telechat") initial_returning_item = bool(e and e.returning_item) initial = dict( telechat_date=e.telechat_date if e else None, returning_item=initial_returning_item, ) if request.method == "POST": form = TelechatForm(request.POST, initial=initial) if form.is_valid(): update_telechat(request, doc, login, form.cleaned_data['telechat_date'], form.cleaned_data['returning_item']) return redirect("doc_view", name=doc.name) else: form = TelechatForm(initial=initial) return render_to_response('doc/edit_telechat_date.html', dict(doc=doc, form=form, user=request.user, login=login), context_instance=RequestContext(request))
def telechat_date(request, name): doc = get_object_or_404(Document, type="statchg", name=name) login = request.user.get_profile() e = doc.latest_event(TelechatDocEvent, type="scheduled_for_telechat") initial_returning_item = bool(e and e.returning_item) initial = dict(telechat_date=e.telechat_date if e else None, returning_item = initial_returning_item, ) if request.method == "POST": form = TelechatForm(request.POST, initial=initial) if form.is_valid(): update_telechat(request, doc, login, form.cleaned_data['telechat_date'], form.cleaned_data['returning_item']) return redirect("doc_view", name=doc.name) else: form = TelechatForm(initial=initial) return render_to_response('doc/edit_telechat_date.html', dict(doc=doc, form=form, user=request.user, login=login), context_instance=RequestContext(request))
def start_rfc_status_change(request,name): """Start the RFC status change review process, setting the initial shepherding AD, and possibly putting the review on a telechat.""" if name: if not re.match("(?i)rfc[0-9]{4}",name): raise Http404 seed_rfc = get_object_or_404(Document, type="draft", docalias__name=name) login = request.user.get_profile() relation_slugs = DocRelationshipName.objects.filter(slug__in=RELATION_SLUGS) if request.method == 'POST': form = StartStatusChangeForm(request.POST) if form.is_valid(): iesg_group = Group.objects.get(acronym='iesg') status_change=Document( type_id = "statchg", name = 'status-change-'+form.cleaned_data['document_name'], title = form.cleaned_data['title'], rev = "00", ad = form.cleaned_data['ad'], notify = form.cleaned_data['notify'], stream_id = 'ietf', group = iesg_group, ) status_change.save() status_change.set_state(form.cleaned_data['create_in_state']) DocAlias.objects.create( name= 'status-change-'+form.cleaned_data['document_name'], document=status_change ) for key in form.cleaned_data['relations']: status_change.relateddocument_set.create(target=DocAlias.objects.get(name=key), relationship_id=form.cleaned_data['relations'][key]) tc_date = form.cleaned_data['telechat_date'] if tc_date: update_telechat(request, status_change, login, tc_date) return HttpResponseRedirect(status_change.get_absolute_url()) else: init = {} if name: init['title'] = "%s to CHANGETHIS" % seed_rfc.title init['document_name'] = "%s-to-CHANGETHIS" % seed_rfc.canonical_name() relations={} relations[seed_rfc.canonical_name()]=None init['relations'] = relations form = StartStatusChangeForm(initial=init) return render_to_response('doc/status_change/start.html', {'form': form, 'relation_slugs': relation_slugs, }, context_instance = RequestContext(request))
def handle_reschedule_form(request, doc, dates): initial = dict(telechat_date=doc.telechat_date()) formargs = dict(telechat_dates=dates, prefix="%s" % doc.name, initial=initial) if request.method == 'POST': form = RescheduleForm(request.POST, **formargs) if form.is_valid(): login = request.user.get_profile() update_telechat(request, doc, login, form.cleaned_data['telechat_date'], False if form.cleaned_data['clear_returning_item'] else None) doc.time = datetime.datetime.now() doc.save() else: form = RescheduleForm(**formargs) form.show_clear = doc.returning_item() return form
def start_review(request, name): """Start the conflict review process, setting the initial shepherding AD, and possibly putting the review on a telechat.""" doc_to_review = get_object_or_404(Document, type="draft", name=name) if not doc_to_review.stream_id in ('ise', 'irtf'): raise Http404 # sanity check that there's not already a conflict review document for this document if [ rel.source for alias in doc_to_review.docalias_set.all() for rel in alias.relateddocument_set.filter( relationship='conflrev') ]: raise Http404 login = request.user.get_profile() if request.method == 'POST': form = StartReviewForm(request.POST) if form.is_valid(): if doc_to_review.name.startswith('draft-'): review_name = 'conflict-review-' + doc_to_review.name[6:] else: # This is a failsafe - and might be treated better as an error review_name = 'conflict-review-' + doc_to_review.name iesg_group = Group.objects.get(acronym='iesg') conflict_review = Document( type_id="conflrev", title="IETF conflict review for %s" % doc_to_review.name, name=review_name, rev="00", ad=form.cleaned_data['ad'], notify=form.cleaned_data['notify'], stream_id='ietf', group=iesg_group, ) conflict_review.save() conflict_review.set_state(form.cleaned_data['create_in_state']) DocAlias.objects.create(name=review_name, document=conflict_review) conflict_review.relateddocument_set.create( target=DocAlias.objects.get(name=doc_to_review.name), relationship_id='conflrev') c = DocEvent(type="added_comment", doc=conflict_review, by=login) c.desc = "IETF conflict review requested" c.save() c = DocEvent(type="added_comment", doc=doc_to_review, by=login) # Is it really OK to put html tags into comment text? c.desc = 'IETF conflict review initiated - see <a href="%s">%s</a>' % ( reverse('doc_view', kwargs={'name': conflict_review.name }), conflict_review.name) c.save() tc_date = form.cleaned_data['telechat_date'] if tc_date: update_telechat(request, conflict_review, login, tc_date) return HttpResponseRedirect(conflict_review.get_absolute_url()) else: # Take care to do the right thing during ietf chair and stream owner transitions ietf_chair_id = Role.objects.filter(group__acronym='ietf', name='chair')[0].person.id notify_addresses = [] notify_addresses.extend([ x.person.formatted_email() for x in Role.objects.filter( group__acronym=doc_to_review.stream.slug, name='chair') ]) notify_addresses.append("%s@%s" % (name, settings.TOOLS_SERVER)) init = { "ad": ietf_chair_id, "notify": u', '.join(notify_addresses), } form = StartReviewForm(initial=init) return render_to_response('doc/conflict_review/start.html', { 'form': form, 'doc_to_review': doc_to_review, }, context_instance=RequestContext(request))
def start_review(request, name): """Start the conflict review process, setting the initial shepherding AD, and possibly putting the review on a telechat.""" doc_to_review = get_object_or_404(Document, type="draft", name=name) if not doc_to_review.stream_id in ('ise','irtf'): raise Http404 # sanity check that there's not already a conflict review document for this document if [ rel.source for alias in doc_to_review.docalias_set.all() for rel in alias.relateddocument_set.filter(relationship='conflrev') ]: raise Http404 login = request.user.get_profile() if request.method == 'POST': form = StartReviewForm(request.POST) if form.is_valid(): if doc_to_review.name.startswith('draft-'): review_name = 'conflict-review-'+doc_to_review.name[6:] else: # This is a failsafe - and might be treated better as an error review_name = 'conflict-review-'+doc_to_review.name iesg_group = Group.objects.get(acronym='iesg') conflict_review=Document( type_id = "conflrev", title = "IETF conflict review for %s" % doc_to_review.name, name = review_name, rev = "00", ad = form.cleaned_data['ad'], notify = form.cleaned_data['notify'], stream_id = 'ietf', group = iesg_group, ) conflict_review.save() conflict_review.set_state(form.cleaned_data['create_in_state']) DocAlias.objects.create( name=review_name , document=conflict_review ) conflict_review.relateddocument_set.create(target=DocAlias.objects.get(name=doc_to_review.name),relationship_id='conflrev') c = DocEvent(type="added_comment", doc=conflict_review, by=login) c.desc = "IETF conflict review requested" c.save() c = DocEvent(type="added_comment", doc=doc_to_review, by=login) # Is it really OK to put html tags into comment text? c.desc = 'IETF conflict review initiated - see <a href="%s">%s</a>' % (reverse('doc_view', kwargs={'name':conflict_review.name}),conflict_review.name) c.save() tc_date = form.cleaned_data['telechat_date'] if tc_date: update_telechat(request, conflict_review, login, tc_date) return HttpResponseRedirect(conflict_review.get_absolute_url()) else: # Take care to do the right thing during ietf chair and stream owner transitions ietf_chair_id = Role.objects.filter(group__acronym='ietf',name='chair')[0].person.id notify_addresses = [] notify_addresses.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=doc_to_review.stream.slug,name='chair')]) notify_addresses.append("%s@%s" % (name, settings.TOOLS_SERVER)) init = { "ad" : ietf_chair_id, "notify" : u', '.join(notify_addresses), } form = StartReviewForm(initial=init) return render_to_response('doc/conflict_review/start.html', {'form': form, 'doc_to_review': doc_to_review, }, context_instance = RequestContext(request))
def start_rfc_status_change(request, name): """Start the RFC status change review process, setting the initial shepherding AD, and possibly putting the review on a telechat.""" if name: if not re.match("(?i)rfc[0-9]{4}", name): raise Http404 seed_rfc = get_object_or_404(Document, type="draft", docalias__name=name) login = request.user.get_profile() relation_slugs = DocRelationshipName.objects.filter( slug__in=RELATION_SLUGS) if request.method == 'POST': form = StartStatusChangeForm(request.POST) if form.is_valid(): iesg_group = Group.objects.get(acronym='iesg') status_change = Document( type_id="statchg", name='status-change-' + form.cleaned_data['document_name'], title=form.cleaned_data['title'], rev="00", ad=form.cleaned_data['ad'], notify=form.cleaned_data['notify'], stream_id='ietf', group=iesg_group, ) status_change.save() status_change.set_state(form.cleaned_data['create_in_state']) DocAlias.objects.create(name='status-change-' + form.cleaned_data['document_name'], document=status_change) for key in form.cleaned_data['relations']: status_change.relateddocument_set.create( target=DocAlias.objects.get(name=key), relationship_id=form.cleaned_data['relations'][key]) tc_date = form.cleaned_data['telechat_date'] if tc_date: update_telechat(request, status_change, login, tc_date) return HttpResponseRedirect(status_change.get_absolute_url()) else: init = {} if name: init['title'] = "%s to CHANGETHIS" % seed_rfc.title init[ 'document_name'] = "%s-to-CHANGETHIS" % seed_rfc.canonical_name( ) relations = {} relations[seed_rfc.canonical_name()] = None init['relations'] = relations form = StartStatusChangeForm(initial=init) return render_to_response('doc/status_change/start.html', { 'form': form, 'relation_slugs': relation_slugs, }, context_instance=RequestContext(request))