diff --git a/ietf/idrfc/lastcall.py b/ietf/idrfc/lastcall.py
index d18d777a0..ba8975502 100644
--- a/ietf/idrfc/lastcall.py
+++ b/ietf/idrfc/lastcall.py
@@ -4,7 +4,6 @@ import datetime
from django.conf import settings
-from ietf.idtracker.models import InternetDraft, DocumentComment, BallotInfo
from ietf.idrfc.mails import *
from ietf.idrfc.utils import *
@@ -12,15 +11,6 @@ from ietf.doc.models import *
from ietf.person.models import Person
def request_last_call(request, doc):
- try:
- ballot = doc.idinternal.ballot
- except BallotInfo.DoesNotExist:
- ballot = generate_ballot(request, doc)
-
- send_last_call_request(request, doc, ballot)
- add_document_comment(request, doc, "Last Call was requested")
-
-def request_last_callREDESIGN(request, doc):
if not doc.latest_event(type="changed_ballot_writeup_text"):
generate_ballot_writeup(request, doc)
if not doc.latest_event(type="changed_ballot_approval_text"):
@@ -37,14 +27,7 @@ def request_last_callREDESIGN(request, doc):
e.desc = "Last call was requested"
e.save()
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- request_last_call = request_last_callREDESIGN
-
def get_expired_last_calls():
- return InternetDraft.objects.filter(lc_expiration_date__lte=datetime.date.today(),
- idinternal__cur_state__document_state_id=IDState.IN_LAST_CALL)
-
-def get_expired_last_callsREDESIGN():
today = datetime.date.today()
for d in Document.objects.filter(states__type="draft-iesg", states__slug="lc"):
e = d.latest_event(LastCallDocEvent, type="sent_last_call")
@@ -52,24 +35,6 @@ def get_expired_last_callsREDESIGN():
yield d
def expire_last_call(doc):
- state = IDState.WAITING_FOR_WRITEUP
-
- try:
- ballot = doc.idinternal.ballot
- if ballot.ballot_writeup and "Relevant content can frequently be found in the abstract" not in ballot.ballot_writeup:
- state = IDState.WAITING_FOR_AD_GO_AHEAD
- except BallotInfo.DoesNotExist:
- pass
-
- doc.idinternal.change_state(IDState.objects.get(document_state_id=state), None)
- doc.idinternal.event_date = datetime.date.today()
- doc.idinternal.save()
-
- log_state_changed(None, doc, by="system", email_watch_list=False)
-
- email_last_call_expired(doc)
-
-def expire_last_callREDESIGN(doc):
state = State.objects.get(used=True, type="draft-iesg", slug="writeupw")
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
@@ -94,8 +59,3 @@ def expire_last_callREDESIGN(doc):
doc.save()
email_last_call_expired(doc)
-
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- get_expired_last_calls = get_expired_last_callsREDESIGN
- expire_last_call = expire_last_callREDESIGN
-
diff --git a/ietf/idrfc/mails.py b/ietf/idrfc/mails.py
index 8def9ca78..67d044c65 100644
--- a/ietf/idrfc/mails.py
+++ b/ietf/idrfc/mails.py
@@ -9,23 +9,12 @@ from django.conf import settings
from django.core.urlresolvers import reverse as urlreverse
from ietf.utils.mail import send_mail, send_mail_text
-from ietf.idtracker.models import *
from ietf.ipr.search import iprs_from_docs, related_docs
-#from ietf.doc.models import *
from ietf.doc.models import WriteupDocEvent, BallotPositionDocEvent, LastCallDocEvent, DocAlias, ConsensusDocEvent
from ietf.person.models import Person
-from ietf.group.models import Group
+from ietf.group.models import Group, Role
def email_state_changed(request, doc, text):
- to = [x.strip() for x in doc.idinternal.state_change_notice_to.replace(';', ',').split(',')]
- if to:
- send_mail(request, to, None,
- "ID Tracker State Update Notice: %s" % doc.file_tag(),
- "idrfc/state_changed_email.txt",
- dict(text=text,
- url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()))
-
-def email_state_changedREDESIGN(request, doc, text):
to = [x.strip() for x in doc.notify.replace(';', ',').split(',')]
if not to:
return
@@ -37,25 +26,21 @@ def email_state_changedREDESIGN(request, doc, text):
dict(text=text,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- email_state_changed = email_state_changedREDESIGN
-
def email_stream_changed(request, doc, old_stream, new_stream, text=""):
"""Email the change text to the notify group and to the stream chairs"""
to = [x.strip() for x in doc.notify.replace(';', ',').split(',')]
- from ietf.group.models import Role as RedesignRole
# These use comprehension to deal with conditions when there might be more than one chair listed for a stream
if old_stream:
- to.extend([x.person.formatted_email() for x in RedesignRole.objects.filter(group__acronym=old_stream.slug,name='chair')])
+ to.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=old_stream.slug,name='chair')])
if new_stream:
- to.extend([x.person.formatted_email() for x in RedesignRole.objects.filter(group__acronym=new_stream.slug,name='chair')])
+ to.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=new_stream.slug,name='chair')])
if not to:
return
if not text:
- text = u"Stream changed to %s from %s"% (new_stream,old_stream)
+ text = u"Stream changed to %s from %s" % (new_stream, old_stream)
text = strip_tags(text)
send_mail(request, to, None,
@@ -86,20 +71,7 @@ def email_authors(request, doc, subject, text):
def html_to_text(html):
return strip_tags(html.replace("<", "<").replace(">", ">").replace("&", "&").replace("
", "\n"))
-def email_owner(request, doc, owner, changed_by, text, subject=None):
- if not owner or not changed_by or owner == changed_by:
- return
-
- to = u"%s <%s>" % owner.person.email()
- send_mail(request, to,
- "DraftTracker Mail System ",
- "%s updated by %s" % (doc.file_tag(), changed_by),
- "idrfc/change_notice.txt",
- dict(text=html_to_text(text),
- doc=doc,
- url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()))
-
-def email_adREDESIGN(request, doc, ad, changed_by, text, subject=None):
+def email_ad(request, doc, ad, changed_by, text, subject=None):
if not ad or not changed_by or ad == changed_by:
return
@@ -112,9 +84,6 @@ def email_adREDESIGN(request, doc, ad, changed_by, text, subject=None):
doc=doc,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- email_owner = email_adREDESIGN
-
def generate_ballot_writeup(request, doc):
e = doc.latest_event(type="iana_review")
@@ -131,10 +100,6 @@ def generate_ballot_writeup(request, doc):
return e
def generate_last_call_announcement(request, doc):
- pass
-
-def generate_last_call_announcementREDESIGN(request, doc):
-
expiration_date = date.today() + timedelta(days=14)
cc = []
if doc.group.type_id in ("individ", "area"):
@@ -177,18 +142,9 @@ def generate_last_call_announcementREDESIGN(request, doc):
return e
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- generate_last_call_announcement = generate_last_call_announcementREDESIGN
-
-def generate_approval_mail(request, doc):
- pass
-
-def generate_approval_mail_rfc_editor(request, doc):
- pass
-
DO_NOT_PUBLISH_IESG_STATES = ("nopubadw", "nopubanw")
-def generate_approval_mailREDESIGN(request, doc):
+def generate_approval_mail(request, doc):
if doc.get_state_slug("draft-iesg") in DO_NOT_PUBLISH_IESG_STATES or doc.stream_id in ('ise','irtf'):
mail = generate_approval_mail_rfc_editor(request, doc)
else:
@@ -253,7 +209,7 @@ def generate_approval_mail_approved(request, doc):
)
)
-def generate_approval_mail_rfc_editorREDESIGN(request, doc):
+def generate_approval_mail_rfc_editor(request, doc):
disapproved = doc.get_state_slug("draft-iesg") in DO_NOT_PUBLISH_IESG_STATES
doc_type = "RFC" if doc.get_state_slug() == "rfc" else "Internet Draft"
@@ -281,10 +237,6 @@ def generate_approval_mail_rfc_editorREDESIGN(request, doc):
)
)
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- generate_approval_mail = generate_approval_mailREDESIGN
- generate_approval_mail_rfc_editor = generate_approval_mail_rfc_editorREDESIGN
-
def generate_publication_request(request, doc):
group_description = ""
if doc.group and doc.group.acronym != "none":
@@ -310,18 +262,7 @@ def generate_publication_request(request, doc):
)
)
-def send_last_call_request(request, doc, ballot):
- to = "iesg-secretary@ietf.org"
- frm = '"DraftTracker Mail System" '
- docs = [d.document() for d in doc.idinternal.ballot_set()]
-
- send_mail(request, to, frm,
- "Last Call: %s" % doc.file_tag(),
- "idrfc/last_call_request.txt",
- dict(docs=docs,
- doc_url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()))
-
-def send_last_call_requestREDESIGN(request, doc):
+def send_last_call_request(request, doc):
to = "iesg-secretary@ietf.org"
frm = '"DraftTracker Mail System" '
@@ -331,21 +272,8 @@ def send_last_call_requestREDESIGN(request, doc):
dict(docs=[doc],
doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- send_last_call_request = send_last_call_requestREDESIGN
-
def email_resurrect_requested(request, doc, by):
to = "I-D Administrator "
- frm = u"%s <%s>" % by.person.email()
- send_mail(request, to, frm,
- "I-D Resurrection Request",
- "idrfc/resurrect_request_email.txt",
- dict(doc=doc,
- by=frm,
- url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()))
-
-def email_resurrect_requestedREDESIGN(request, doc, by):
- to = "I-D Administrator "
if by.role_set.filter(name="secr", group__acronym="secretariat"):
e = by.role_email("secr", group="secretariat")
@@ -360,20 +288,7 @@ def email_resurrect_requestedREDESIGN(request, doc, by):
by=frm,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- email_resurrect_requested = email_resurrect_requestedREDESIGN
-
-def email_resurrection_completed(request, doc):
- to = u"%s <%s>" % doc.idinternal.resurrect_requested_by.person.email()
- frm = "I-D Administrator "
- send_mail(request, to, frm,
- "I-D Resurrection Completed - %s" % doc.file_tag(),
- "idrfc/resurrect_completed_email.txt",
- dict(doc=doc,
- by=frm,
- url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()))
-
-def email_resurrection_completedREDESIGN(request, doc, requester):
+def email_resurrection_completed(request, doc, requester):
if requester.role_set.filter(name="secr", group__acronym="secretariat"):
e = requester.role_email("secr", group="secretariat")
else:
@@ -388,9 +303,6 @@ def email_resurrection_completedREDESIGN(request, doc, requester):
by=frm,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- email_resurrection_completed = email_resurrection_completedREDESIGN
-
def email_ballot_deferred(request, doc, by, telechat_date):
to = "iesg@ietf.org"
frm = "DraftTracker Mail System "
@@ -401,10 +313,7 @@ def email_ballot_deferred(request, doc, by, telechat_date):
by=by,
telechat_date=telechat_date))
-def generate_issue_ballot_mail(request, doc):
- pass
-
-def generate_issue_ballot_mailREDESIGN(request, doc, ballot):
+def generate_issue_ballot_mail(request, doc, ballot):
active_ads = Person.objects.filter(role__name="ad", role__group__state="active").distinct()
positions = BallotPositionDocEvent.objects.filter(doc=doc, type="changed_ballot_position", ballot=ballot).order_by("-time", '-id').select_related('ad')
@@ -456,7 +365,7 @@ def generate_issue_ballot_mailREDESIGN(request, doc, ballot):
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
ballot_writeup = e.text if e else ""
- return render_to_string("idrfc/issue_ballot_mailREDESIGN.txt",
+ return render_to_string("idrfc/issue_ballot_mail.txt",
dict(doc=doc,
doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
active_ad_positions=active_ad_positions,
@@ -468,9 +377,6 @@ def generate_issue_ballot_mailREDESIGN(request, doc, ballot):
)
)
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- generate_issue_ballot_mail = generate_issue_ballot_mailREDESIGN
-
def email_iana(request, doc, to, msg):
# fix up message and send it with extra info on doc in headers
import email
@@ -494,19 +400,6 @@ def extra_automation_headers(doc):
return extra
def email_last_call_expired(doc):
- text = "IETF Last Call has ended, and the state has been changed to\n%s." % doc.idinternal.cur_state.state
-
- send_mail(None,
- "iesg@ietf.org",
- "DraftTracker Mail System ",
- "Last Call Expired: %s" % doc.file_tag(),
- "idrfc/change_notice.txt",
- dict(text=text,
- doc=doc,
- url=settings.IDTRACKER_BASE_URL + doc.idinternal.get_absolute_url()),
- cc="iesg-secretary@ietf.org")
-
-def email_last_call_expiredREDESIGN(doc):
text = "IETF Last Call has ended, and the state has been changed to\n%s." % doc.get_state("draft-iesg").name
to = [x.strip() for x in doc.notify.replace(';', ',').split(',')]
@@ -521,7 +414,3 @@ def email_last_call_expiredREDESIGN(doc):
doc=doc,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()),
cc="iesg-secretary@ietf.org")
-
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- email_last_call_expired = email_last_call_expiredREDESIGN
-
diff --git a/ietf/idrfc/templatetags/mail_filters.py b/ietf/idrfc/templatetags/mail_filters.py
index 8477cb4e3..7a12c8ac0 100644
--- a/ietf/idrfc/templatetags/mail_filters.py
+++ b/ietf/idrfc/templatetags/mail_filters.py
@@ -1,7 +1,6 @@
from django import template
from django.core.cache import cache
from django.template import loader
-from ietf.idtracker.models import Area
register = template.Library()
diff --git a/ietf/idrfc/templatetags/wg_menu.py b/ietf/idrfc/templatetags/wg_menu.py
index e26dc0591..e52f3e571 100644
--- a/ietf/idrfc/templatetags/wg_menu.py
+++ b/ietf/idrfc/templatetags/wg_menu.py
@@ -33,7 +33,8 @@
from django import template
from django.core.cache import cache
from django.template import loader
-from ietf.idtracker.models import Area
+
+from ietf.group.models import Group
register = template.Library()
@@ -42,26 +43,27 @@ area_short_names = {
'rai':'RAI'
}
-def get_short_name(area):
- if area.area_acronym.acronym in area_short_names:
- return area_short_names[area.area_acronym.acronym]
- else:
- area_name = area.area_acronym.name
- if area_name.endswith(" Area"):
- area_name = area_name[:-5]
- return area_name
-
class WgMenuNode(template.Node):
- def __init__(self):
- pass
def render(self, context):
x = cache.get('idrfc_wgmenu')
if x:
return x
- areas = [{'area':x, 'short_name':get_short_name(x)} for x in Area.active_areas()]
- x = loader.render_to_string('base_wgmenu.html', {'areas':areas})
+
+ areas = Group.objects.filter(type="area", state="active").order_by('acronym')
+ groups = Group.objects.filter(type="wg", state="active", parent__in=areas).order_by("acronym")
+
+ for a in areas:
+ a.short_area_name = area_short_names.get(a.acronym) or a.name
+ if a.short_area_name.endswith(" Area"):
+ a.short_area_name = a.short_area_name[:-len(" Area")]
+
+ a.active_groups = [g for g in groups if g.parent_id == a.id]
+
+ areas = [a for a in areas if a.active_groups]
+
+ res = loader.render_to_string('base_wgmenu.html', {'areas':areas})
cache.set('idrfc_wgmenu', x, 30*60)
- return x
+ return res
def do_wg_menu(parser, token):
return WgMenuNode()
diff --git a/ietf/idrfc/utils.py b/ietf/idrfc/utils.py
index 4cc8df32b..590fca086 100644
--- a/ietf/idrfc/utils.py
+++ b/ietf/idrfc/utils.py
@@ -1,6 +1,5 @@
from django.conf import settings
-from ietf.idtracker.models import InternetDraft, DocumentComment, BallotInfo, IESGLogin
from ietf.idrfc.mails import *
from ietf.ietfauth.utils import has_role, is_authorized_in_doc_stream
@@ -32,38 +31,7 @@ def generate_ballot(request, doc):
doc.idinternal.ballot = ballot
return ballot
-def log_state_changed(request, doc, by, email_watch_list=True, note=''):
- change = u"State changed to %s from %s." % (
- doc.idinternal.docstate(),
- format_document_state(doc.idinternal.prev_state,
- doc.idinternal.prev_sub_state))
- if note:
- change += "
%s" % note
-
- c = DocumentComment()
- c.document = doc.idinternal
- c.public_flag = True
- c.version = doc.revision_display()
- c.comment_text = change
-
- if doc.idinternal.docstate()=="In Last Call":
- c.comment_text += "\n\nThe following Last Call Announcement was sent out:\n\n"
- c.comment_text += doc.idinternal.ballot.last_call_text
-
-
- if isinstance(by, IESGLogin):
- c.created_by = by
- c.result_state = doc.idinternal.cur_state
- c.origin_state = doc.idinternal.prev_state
- c.rfc_flag = doc.idinternal.rfc_flag
- c.save()
-
- if email_watch_list:
- email_state_changed(request, doc, strip_tags(change))
-
- return change
-
-def log_state_changedREDESIGN(request, doc, by, prev_iesg_state, prev_iesg_tag):
+def log_state_changed(request, doc, by, prev_iesg_state, prev_iesg_tag):
from ietf.doc.models import DocEvent, IESG_SUBSTATE_TAGS
state = doc.get_state("draft-iesg")
@@ -83,47 +51,7 @@ def log_state_changedREDESIGN(request, doc, by, prev_iesg_state, prev_iesg_tag):
e.save()
return e
-
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- log_state_changed = log_state_changedREDESIGN
-
-
-def update_telechat(request, idinternal, new_telechat_date, new_returning_item=None):
- on_agenda = bool(new_telechat_date)
-
- if new_returning_item == None:
- new_returning_item = idinternal.returning_item
-
- returning_item_changed = False
- if idinternal.returning_item != bool(new_returning_item):
- idinternal.returning_item = bool(new_returning_item)
- returning_item_changed = True
-
- # auto-update returning item
- if (not returning_item_changed and
- on_agenda and idinternal.agenda
- and new_telechat_date != idinternal.telechat_date):
- idinternal.returning_item = True
-
- # update agenda
- doc = idinternal.document()
- if bool(idinternal.agenda) != on_agenda:
- if on_agenda:
- add_document_comment(request, doc,
- "Placed on agenda for telechat - %s" % new_telechat_date)
- idinternal.telechat_date = new_telechat_date
- else:
- add_document_comment(request, doc,
- "Removed from agenda for telechat")
- idinternal.agenda = on_agenda
- elif on_agenda and new_telechat_date != idinternal.telechat_date:
- add_document_comment(request, doc,
- "Telechat date has been changed to %s from %s" %
- (new_telechat_date,
- idinternal.telechat_date))
- idinternal.telechat_date = new_telechat_date
-
-def update_telechatREDESIGN(request, doc, by, new_telechat_date, new_returning_item=None):
+def update_telechat(request, doc, by, new_telechat_date, new_returning_item=None):
from ietf.doc.models import TelechatDocEvent
on_agenda = bool(new_telechat_date)
@@ -173,7 +101,3 @@ def update_telechatREDESIGN(request, doc, by, new_telechat_date, new_returning_i
e.desc = "Removed telechat returning item indication"
e.save()
-
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- update_telechat = update_telechatREDESIGN
-
diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py
index f8a9fc5cc..746d4278d 100644
--- a/ietf/idrfc/views_ballot.py
+++ b/ietf/idrfc/views_ballot.py
@@ -1,8 +1,8 @@
# ballot management (voting, commenting, writeups, ...) for Area
# Directors and Secretariat
-import re, os
-from datetime import datetime, date, time, timedelta
+import re, os, datetime
+
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse as urlreverse
@@ -16,11 +16,8 @@ from django.conf import settings
import debug
from ietf.utils.mail import send_mail_text, send_mail_preformatted
-from ietf.ietfauth.decorators import group_required, role_required
-from ietf.idtracker.templatetags.ietf_filters import in_group
from ietf.ietfauth.decorators import has_role, role_required
-from ietf.idtracker.models import *
-from ietf.iesg.models import *
+from ietf.iesg.models import TelechatDate
from ietf.ipr.models import IprDetail
from ietf.ipr.search import iprs_from_docs
from ietf.idrfc.mails import *
@@ -54,7 +51,7 @@ def do_undefer_ballot(request, doc):
logging, and the Document object.
'''
login = request.user.get_profile()
- telechat_date = TelechatDates.objects.all()[0].date1
+ telechat_date = TelechatDate.objects.active().order_by("date")[0].date
save_document_in_history(doc)
prev_state = doc.friendly_state()
@@ -96,15 +93,8 @@ def get_ballot_info(ballot, area_director):
return (pos, discuss, comment)
-class EditPositionForm(forms.Form):
- pass
-
# -------------------------------------------------
-@group_required('Area_Director','Secretariat')
-def edit_position(request, name):
- pass
-
-class EditPositionFormREDESIGN(forms.Form):
+class EditPositionForm(forms.Form):
position = forms.ModelChoiceField(queryset=BallotPositionName.objects.all(), widget=forms.RadioSelect, initial="norecord", required=True)
discuss = forms.CharField(required=False, widget=forms.Textarea)
comment = forms.CharField(required=False, widget=forms.Textarea)
@@ -123,7 +113,7 @@ class EditPositionFormREDESIGN(forms.Form):
return entered_discuss
@role_required('Area Director','Secretariat')
-def edit_positionREDESIGN(request, name, ballot_id):
+def edit_position(request, name, ballot_id):
"""Vote and edit discuss and comment on document as Area Director."""
doc = get_object_or_404(Document, docalias__name=name)
ballot = get_object_or_404(BallotDocEvent, type="created_ballot", pk=ballot_id, doc=doc)
@@ -244,7 +234,7 @@ def edit_positionREDESIGN(request, name, ballot_id):
ballot_deferred = doc.active_defer_event()
- return render_to_response('idrfc/edit_positionREDESIGN.html',
+ return render_to_response('idrfc/edit_position.html',
dict(doc=doc,
form=form,
ad=ad,
@@ -257,85 +247,9 @@ def edit_positionREDESIGN(request, name, ballot_id):
),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- edit_position = edit_positionREDESIGN
- EditPositionForm = EditPositionFormREDESIGN
-
-
-@group_required('Area_Director','Secretariat')
-def send_ballot_comment(request, name):
- """Email Internet Draft ballot discuss/comment for area director."""
- doc = get_object_or_404(InternetDraft, filename=name)
- if not doc.idinternal:
- raise Http404()
-
- ad = login = IESGLogin.objects.get(login_name=request.user.username)
-
- return_to_url = request.GET.get('return_to_url')
- if not return_to_url:
- return_to_url = doc.idinternal.get_absolute_url()
-
- if 'HTTP_REFERER' in request.META:
- back_url = request.META['HTTP_REFERER']
- else:
- back_url = doc.idinternal.get_absolute_url()
-
-
-
- # if we're in the Secretariat, we can select an AD to act as stand-in for
- if not in_group(request.user, "Area_Director"):
- ad_username = request.GET.get('ad')
- if not ad_username:
- raise Http404()
- ad = get_object_or_404(IESGLogin, login_name=ad_username)
-
- pos, discuss, comment = get_ballot_info(doc.idinternal.ballot, ad)
-
- subj = []
- d = ""
- if pos and pos.discuss == 1 and discuss and discuss.text:
- d = discuss.text
- subj.append("DISCUSS")
- c = ""
- if comment and comment.text:
- c = comment.text
- subj.append("COMMENT")
-
-
- ad_name = str(ad)
- ad_name_genitive = ad_name + "'" if ad_name.endswith('s') else ad_name + "'s"
- subject = "%s %s on %s" % (ad_name_genitive, pos.name() if pos else "No Position" , doc.filename + '-' + doc.revision_display())
- if subj:
- subject += ": (with "+" and ".join(subj)+")"
-
- body = render_to_string("idrfc/ballot_comment_mail.txt",
- dict(discuss=d, comment=c, ad=ad, doc=doc, pos=pos, settings=settings))
- frm = u"%s <%s>" % ad.person.email()
- to = "The IESG "
-
- if request.method == 'POST':
- cc = [x.strip() for x in request.POST.get("cc", "").split(',') if x.strip()]
- if request.POST.get("cc_state_change") and doc.idinternal.state_change_notice_to:
- cc.extend(doc.idinternal.state_change_notice_to.split(','))
-
- send_mail_text(request, to, frm, subject, body, cc=", ".join(cc))
-
- return HttpResponseRedirect(return_to_url)
-
- return render_to_response('idrfc/send_ballot_comment.html',
- dict(doc=doc,
- subject=subject,
- body=body,
- frm=frm,
- to=to,
- ad=ad,
- can_send=d or c,
- back_url=back_url,
- ),
- context_instance=RequestContext(request))
@role_required('Area Director','Secretariat')
-def send_ballot_commentREDESIGN(request, name, ballot_id):
+def send_ballot_comment(request, name, ballot_id):
"""Email document ballot position discuss/comment for Area Director."""
doc = get_object_or_404(Document, docalias__name=name)
ballot = get_object_or_404(BallotDocEvent, type="created_ballot", pk=ballot_id, doc=doc)
@@ -399,7 +313,7 @@ def send_ballot_commentREDESIGN(request, name, ballot_id):
return HttpResponseRedirect(return_to_url)
- return render_to_response('idrfc/send_ballot_commentREDESIGN.html',
+ return render_to_response('idrfc/send_ballot_comment.html',
dict(doc=doc,
subject=subject,
body=body,
@@ -411,10 +325,7 @@ def send_ballot_commentREDESIGN(request, name, ballot_id):
),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- send_ballot_comment = send_ballot_commentREDESIGN
-
-@group_required('Secretariat')
+@role_required('Secretariat')
def clear_ballot(request, name):
"""Clear all positions and discusses on every open ballot for a document."""
doc = get_object_or_404(Document, name=name)
@@ -432,12 +343,8 @@ def clear_ballot(request, name):
back_url=doc.get_absolute_url()),
context_instance=RequestContext(request))
-@group_required('Area_Director','Secretariat')
+@role_required('Area Director','Secretariat')
def defer_ballot(request, name):
- pass
-
-@group_required('Area_Director','Secretariat')
-def defer_ballotREDESIGN(request, name):
"""Signal post-pone of ballot, notifying relevant parties."""
doc = get_object_or_404(Document, docalias__name=name)
if doc.type_id not in ('draft','conflrev'):
@@ -446,7 +353,7 @@ def defer_ballotREDESIGN(request, name):
raise Http404()
login = request.user.get_profile()
- telechat_date = TelechatDates.objects.all()[0].date2
+ telechat_date = TelechatDate.objects.active().order_by("date")[1].date
if request.method == 'POST':
save_document_in_history(doc)
@@ -479,15 +386,8 @@ def defer_ballotREDESIGN(request, name):
back_url=doc.get_absolute_url()),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- defer_ballot = defer_ballotREDESIGN
-
-@group_required('Area_Director','Secretariat')
+@role_required('Area Director','Secretariat')
def undefer_ballot(request, name):
- pass
-
-@group_required('Area_Director','Secretariat')
-def undefer_ballotREDESIGN(request, name):
"""undo deferral of ballot ballot."""
doc = get_object_or_404(Document, docalias__name=name)
if doc.type_id not in ('draft','conflrev'):
@@ -495,7 +395,7 @@ def undefer_ballotREDESIGN(request, name):
if doc.type_id == 'draft' and not doc.get_state("draft-iesg"):
raise Http404()
- telechat_date = TelechatDates.objects.all()[0].date1
+ telechat_date = TelechatDate.objects.active().order_by("date")[0].date
if request.method == 'POST':
do_undefer_ballot(request,doc)
@@ -507,97 +407,7 @@ def undefer_ballotREDESIGN(request, name):
back_url=doc.get_absolute_url()),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- undefer_ballot = undefer_ballotREDESIGN
-
-class LastCallTextForm(forms.ModelForm):
- def clean_last_call_text(self):
- lines = self.cleaned_data["last_call_text"].split("\r\n")
- for l, next in zip(lines, lines[1:]):
- if l.startswith('Subject:') and next.strip():
- raise forms.ValidationError("Subject line appears to have a line break, please make sure there is no line breaks in the subject line and that it is followed by an empty line.")
-
- return self.cleaned_data["last_call_text"].replace("\r", "")
-
- class Meta:
- model = BallotInfo
- fields = ["last_call_text"]
-
-class BallotWriteupForm(forms.ModelForm):
- class Meta:
- model = BallotInfo
- fields = ["ballot_writeup"]
-
- def clean_ballot_writeup(self):
- return self.cleaned_data["ballot_writeup"].replace("\r", "")
-
-@group_required('Area_Director','Secretariat')
-def lastcalltext(request, name):
- """Editing of the last call text"""
- doc = get_object_or_404(InternetDraft, filename=name)
- if not doc.idinternal:
- raise Http404()
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- try:
- ballot = doc.idinternal.ballot
- except BallotInfo.DoesNotExist:
- ballot = generate_ballot(request, doc)
-
- last_call_form = LastCallTextForm(instance=ballot)
-
- if request.method == 'POST':
- if "save_last_call_text" in request.POST or "send_last_call_request" in request.POST:
- last_call_form = LastCallTextForm(request.POST, instance=ballot)
- if last_call_form.is_valid():
- ballot.last_call_text = last_call_form.cleaned_data["last_call_text"]
- add_document_comment(request, doc, "Last Call text changed")
- ballot.save()
-
- if "send_last_call_request" in request.POST:
- doc.idinternal.change_state(IDState.objects.get(document_state_id=IDState.LAST_CALL_REQUESTED), None)
-
- change = idrfcutil_log_state_changed(request, doc, login)
- email_owner(request, doc, doc.idinternal.job_owner, login, change)
- request_last_call(request, doc)
-
- doc.idinternal.event_date = date.today()
- doc.idinternal.save()
-
- return render_to_response('idrfc/last_call_requested.html',
- dict(doc=doc),
- context_instance=RequestContext(request))
-
- if "regenerate_last_call_text" in request.POST:
- ballot.last_call_text = generate_last_call_announcement(request, doc)
- ballot.save()
-
- # make sure form has the updated text
- last_call_form = LastCallTextForm(instance=ballot)
-
- doc.idinternal.event_date = date.today()
- doc.idinternal.save()
-
- can_request_last_call = doc.idinternal.cur_state_id < 27
- can_make_last_call = doc.idinternal.cur_state_id < 20
- can_announce = doc.idinternal.cur_state_id > 19
- docs_with_invalid_status = [d.document().file_tag() for d in doc.idinternal.ballot_set() if "None" in d.document().intended_status.intended_status or "Request" in d.document().intended_status.intended_status]
- need_intended_status = ", ".join(docs_with_invalid_status)
-
- return render_to_response('idrfc/ballot_lastcalltext.html',
- dict(doc=doc,
- back_url=doc.idinternal.get_absolute_url(),
- ballot=ballot,
- last_call_form=last_call_form,
- can_request_last_call=can_request_last_call,
- can_make_last_call=can_make_last_call,
- need_intended_status=need_intended_status,
- ),
- context_instance=RequestContext(request))
-
-
-class LastCallTextFormREDESIGN(forms.Form):
+class LastCallTextForm(forms.Form):
last_call_text = forms.CharField(widget=forms.Textarea, required=True)
def clean_last_call_text(self):
@@ -608,8 +418,9 @@ class LastCallTextFormREDESIGN(forms.Form):
return self.cleaned_data["last_call_text"].replace("\r", "")
-@group_required('Area_Director','Secretariat')
-def lastcalltextREDESIGN(request, name):
+
+@role_required('Area Director','Secretariat')
+def lastcalltext(request, name):
"""Editing of the last call text"""
doc = get_object_or_404(Document, docalias__name=name)
if not doc.get_state("draft-iesg"):
@@ -653,7 +464,7 @@ def lastcalltextREDESIGN(request, name):
doc.save()
email_state_changed(request, doc, e.desc)
- email_owner(request, doc, doc.ad, login, e.desc)
+ email_ad(request, doc, doc.ad, login, e.desc)
request_last_call(request, doc)
@@ -687,95 +498,14 @@ def lastcalltextREDESIGN(request, name):
),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- LastCallTextForm = LastCallTextFormREDESIGN
- lastcalltext = lastcalltextREDESIGN
-
-
-@group_required('Area_Director','Secretariat')
-def ballot_writeupnotes(request, name):
- """Editing of ballot write-up and notes"""
- doc = get_object_or_404(InternetDraft, filename=name)
- if not doc.idinternal:
- raise Http404()
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- try:
- ballot = doc.idinternal.ballot
- except BallotInfo.DoesNotExist:
- ballot = generate_ballot(request, doc)
-
- ballot_writeup_form = BallotWriteupForm(instance=ballot)
-
- if request.method == 'POST':
-
- if "save_ballot_writeup" in request.POST:
- ballot_writeup_form = BallotWriteupForm(request.POST, instance=ballot)
- if ballot_writeup_form.is_valid():
- ballot.ballot_writeup = ballot_writeup_form.cleaned_data["ballot_writeup"]
- add_document_comment(request, doc, "Ballot writeup text changed")
- ballot.save()
-
- if "issue_ballot" in request.POST:
- ballot_writeup_form = BallotWriteupForm(request.POST, instance=ballot)
- approval_text_form = ApprovalTextForm(request.POST, instance=ballot)
- if ballot_writeup_form.is_valid() and approval_text_form.is_valid():
- ballot.ballot_writeup = ballot_writeup_form.cleaned_data["ballot_writeup"]
- ballot.approval_text = approval_text_form.cleaned_data["approval_text"]
- ballot.active = True
- ballot.ballot_issued = True
- ballot.save()
-
- if not Position.objects.filter(ballot=ballot, ad=login):
- pos = Position()
- pos.ballot = ballot
- pos.ad = login
- pos.yes = 1
- pos.noobj = pos.abstain = pos.approve = pos.discuss = pos.recuse = 0
- pos.save()
-
- msg = generate_issue_ballot_mail(request, doc)
- send_mail_preformatted(request, msg)
-
-# email_iana(request, doc, 'drafts-eval@icann.org', msg)
-
- doc.b_sent_date = date.today()
- doc.save()
-
- add_document_comment(request, doc, "Ballot has been issued")
-
- doc.idinternal.event_date = date.today()
- doc.idinternal.save()
-
- return render_to_response('idrfc/ballot_issued.html',
- dict(doc=doc,
- back_url=doc.idinternal.get_absolute_url()),
- context_instance=RequestContext(request))
-
-
- doc.idinternal.event_date = date.today()
- doc.idinternal.save()
-
- docs_with_invalid_status = [d.document().file_tag() for d in doc.idinternal.ballot_set() if "None" in d.document().intended_status.intended_status or "Request" in d.document().intended_status.intended_status]
- need_intended_status = ", ".join(docs_with_invalid_status)
-
- return render_to_response('idrfc/ballot_writeupnotes.html',
- dict(doc=doc,
- ballot=ballot,
- ballot_writeup_form=ballot_writeup_form,
- need_intended_status=need_intended_status,
- ),
- context_instance=RequestContext(request))
-
-class BallotWriteupFormREDESIGN(forms.Form):
+class BallotWriteupForm(forms.Form):
ballot_writeup = forms.CharField(widget=forms.Textarea, required=True)
def clean_ballot_writeup(self):
return self.cleaned_data["ballot_writeup"].replace("\r", "")
-@group_required('Area_Director','Secretariat')
-def ballot_writeupnotesREDESIGN(request, name):
+@role_required('Area Director','Secretariat')
+def ballot_writeupnotes(request, name):
"""Editing of ballot write-up and notes"""
doc = get_object_or_404(Document, docalias__name=name)
@@ -838,7 +568,7 @@ def ballot_writeupnotesREDESIGN(request, name):
if not doc.intended_std_level:
need_intended_status = doc.file_tag()
- return render_to_response('idrfc/ballot_writeupnotesREDESIGN.html',
+ return render_to_response('idrfc/ballot_writeupnotes.html',
dict(doc=doc,
back_url=doc.get_absolute_url(),
ballot_issued=bool(doc.latest_event(type="sent_ballot_announcement")),
@@ -847,19 +577,13 @@ def ballot_writeupnotesREDESIGN(request, name):
),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- BallotWriteupForm = BallotWriteupFormREDESIGN
- ballot_writeupnotes = ballot_writeupnotesREDESIGN
-
-
-
class ApprovalTextForm(forms.Form):
approval_text = forms.CharField(widget=forms.Textarea, required=True)
def clean_approval_text(self):
return self.cleaned_data["approval_text"].replace("\r", "")
-@group_required('Area_Director','Secretariat')
+@role_required('Area Director','Secretariat')
def ballot_approvaltext(request, name):
"""Editing of approval text"""
doc = get_object_or_404(Document, docalias__name=name)
@@ -907,80 +631,8 @@ def ballot_approvaltext(request, name):
),
context_instance=RequestContext(request))
-
-@group_required('Secretariat')
+@role_required('Secretariat')
def approve_ballot(request, name):
- """Approve ballot, sending out announcement, changing state."""
- doc = get_object_or_404(InternetDraft, filename=name)
- if not doc.idinternal:
- raise Http404()
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- ballot = doc.idinternal.ballot
-
- if "To: RFC Editor" in ballot.approval_text:
- action = "to_rfc_editor"
- elif "NOT be published" in ballot.approval_text:
- action = "do_not_publish"
- else:
- action = "to_announcement_list"
-
- announcement = ballot.approval_text + "\n\n" + ballot.ballot_writeup
-
- if request.method == 'POST':
- for i in doc.idinternal.ballot_set():
- if action == "do_not_publish":
- new_state = IDState.DEAD
- else:
- new_state = IDState.APPROVED_ANNOUNCEMENT_SENT
-
- i.change_state(IDState.objects.get(document_state_id=new_state), None)
-
- if action == "do_not_publish":
- i.dnp = True
- i.dnp_date = date.today()
- i.noproblem = False
-
- if action == "to_rfc_editor":
- i.noproblem = True
-
- i.event_date = date.today()
- i.save()
-
- i.document().b_approve_date = date.today()
- i.document().save()
-
- if action == "do_not_publish":
- comment = "Do Not Publish note has been sent to RFC Editor"
- else:
- comment = "IESG has approved"
-
- comment += " and state has been changed to %s" % i.cur_state.state
- add_document_comment(request, i.document(), comment)
- email_owner(request, i.document(), i.job_owner, login, comment)
- email_state_changed(request, i.document(), strip_tags(comment))
-
- send_mail_preformatted(request, announcement)
-
- ballot.an_sent = True
- ballot.an_sent_date = date.today()
- ballot.an_sent_by = login
- ballot.save()
-
- if action == "to_announcement_list":
- email_iana(request, doc, "drafts-approval@icann.org", announcement)
-
- return HttpResponseRedirect(doc.idinternal.get_absolute_url())
-
- return render_to_response('idrfc/approve_ballot.html',
- dict(doc=doc,
- action=action,
- announcement=announcement),
- context_instance=RequestContext(request))
-
-@group_required('Secretariat')
-def approve_ballotREDESIGN(request, name):
"""Approve ballot, sending out announcement, changing state."""
doc = get_object_or_404(Document, docalias__name=name)
if not doc.get_state("draft-iesg"):
@@ -1059,7 +711,7 @@ def approve_ballotREDESIGN(request, name):
doc.save()
email_state_changed(request, doc, change_description)
- email_owner(request, doc, doc.ad, login, change_description)
+ email_ad(request, doc, doc.ad, login, change_description)
# send announcement
@@ -1082,15 +734,12 @@ def approve_ballotREDESIGN(request, name):
announcement=announcement),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- approve_ballot = approve_ballotREDESIGN
-
class MakeLastCallForm(forms.Form):
last_call_sent_date = forms.DateField(required=True)
last_call_expiration_date = forms.DateField(required=True)
-@group_required('Secretariat')
+@role_required('Secretariat')
def make_last_call(request, name):
"""Make last call for Internet Draft, sending out announcement."""
doc = get_object_or_404(Document, docalias__name=name)
@@ -1145,7 +794,7 @@ def make_last_call(request, name):
doc.save()
email_state_changed(request, doc, change_description)
- email_owner(request, doc, doc.ad, login, change_description)
+ email_ad(request, doc, doc.ad, login, change_description)
e = LastCallDocEvent(doc=doc, by=login)
e.type = "sent_last_call"
@@ -1168,18 +817,18 @@ def make_last_call(request, name):
return HttpResponseRedirect(doc.get_absolute_url())
else:
initial = {}
- initial["last_call_sent_date"] = date.today()
+ initial["last_call_sent_date"] = datetime.date.today()
if doc.type.slug == 'draft':
# This logic is repeated in the code that edits last call text - why?
expire_days = 14
if doc.group.type_id in ("individ", "area"):
expire_days = 28
- templ = 'idrfc/make_last_callREDESIGN.html'
+ templ = 'idrfc/make_last_call.html'
else:
expire_days=28
templ = 'doc/status_change/make_last_call.html'
- initial["last_call_expiration_date"] = date.today() + timedelta(days=expire_days)
+ initial["last_call_expiration_date"] = datetime.date.today() + datetime.timedelta(days=expire_days)
form = MakeLastCallForm(initial=initial)
diff --git a/ietf/idrfc/views_edit.py b/ietf/idrfc/views_edit.py
index 5a0221b04..54cdd919d 100644
--- a/ietf/idrfc/views_edit.py
+++ b/ietf/idrfc/views_edit.py
@@ -1,8 +1,8 @@
# changing state and metadata and commenting on Internet Drafts for
# Area Directors and Secretariat
-import re, os
-from datetime import datetime, date, time, timedelta
+import re, os, datetime
+
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse as urlreverse
@@ -16,11 +16,9 @@ from django.forms.util import ErrorList
from django.contrib.auth.decorators import login_required
from ietf.utils.mail import send_mail_text, send_mail_message
-from ietf.ietfauth.decorators import group_required, has_role, role_required
+from ietf.ietfauth.decorators import has_role, role_required
from ietf.ietfauth.utils import user_is_person
-from ietf.idtracker.templatetags.ietf_filters import in_group
-from ietf.idtracker.models import *
-from ietf.iesg.models import *
+from ietf.iesg.models import TelechatDate
from ietf.idrfc.mails import *
from ietf.idrfc.utils import *
from ietf.idrfc.lastcall import request_last_call
@@ -41,13 +39,6 @@ from ietf.message.models import Message
from ietf.idrfc.utils import log_state_changed
class ChangeStateForm(forms.Form):
- pass
-
-@group_required('Area_Director','Secretariat')
-def change_state(request, name):
- pass
-
-class ChangeStateFormREDESIGN(forms.Form):
state = forms.ModelChoiceField(State.objects.filter(used=True, type="draft-iesg"), empty_label=None, required=True)
substate = forms.ModelChoiceField(DocTagName.objects.filter(slug__in=IESG_SUBSTATE_TAGS), required=False)
comment = forms.CharField(widget=forms.Textarea, required=False)
@@ -69,8 +60,8 @@ class ChangeStateFormREDESIGN(forms.Form):
self._errors['comment'] = ErrorList([u'State not changed. Comments entered will be lost with no state change. Please go back and use the Add Comment feature on the history tab to add comments without changing state.'])
return retclean
-@group_required('Area_Director','Secretariat')
-def change_stateREDESIGN(request, name):
+@role_required('Area Director','Secretariat')
+def change_state(request, name):
"""Change state of Internet Draft, notifying parties as necessary
and logging the change as a comment."""
doc = get_object_or_404(Document, docalias__name=name)
@@ -120,7 +111,7 @@ def change_stateREDESIGN(request, name):
doc.save()
email_state_changed(request, doc, e.desc)
- email_owner(request, doc, doc.ad, login, e.desc)
+ email_ad(request, doc, doc.ad, login, e.desc)
if prev_state and prev_state.slug in ("ann", "rfcqueue") and next_state.slug not in ("rfcqueue", "pub"):
@@ -161,7 +152,7 @@ def change_stateREDESIGN(request, name):
to_iesg_eval = State.objects.get(used=True, type="draft-iesg", slug="iesg-eva")
next_states = next_states.exclude(slug="iesg-eva")
- return render_to_response('idrfc/change_stateREDESIGN.html',
+ return render_to_response('idrfc/change_state.html',
dict(form=form,
doc=doc,
state=state,
@@ -170,10 +161,6 @@ def change_stateREDESIGN(request, name):
to_iesg_eval=to_iesg_eval),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- change_state = change_stateREDESIGN
- ChangeStateForm = ChangeStateFormREDESIGN
-
class ChangeIanaStateForm(forms.Form):
state = forms.ModelChoiceField(State.objects.all(), required=False)
@@ -327,7 +314,7 @@ def change_intention(request, name):
doc.time = e.time
doc.save()
- email_owner(request, doc, doc.ad, login, email_desc)
+ email_ad(request, doc, doc.ad, login, email_desc)
return HttpResponseRedirect(doc.get_absolute_url())
@@ -341,39 +328,7 @@ def change_intention(request, name):
),
context_instance=RequestContext(request))
-def dehtmlify_textarea_text(s):
- return s.replace("
", "\n").replace("", "").replace("", "").replace(" ", " ")
-
class EditInfoForm(forms.Form):
- pass
-
-def get_initial_state_change_notice(doc):
- # set change state notice to something sensible
- receivers = []
- if doc.group_id == Acronym.INDIVIDUAL_SUBMITTER:
- for a in doc.authors.all():
- # maybe it would be more appropriate to use a.email() ?
- e = a.person.email()[1]
- if e:
- receivers.append(e)
- else:
- receivers.append("%s-chairs@%s" % (doc.group.acronym, settings.TOOLS_SERVER))
- for editor in doc.group.ietfwg.wgeditor_set.all():
- e = editor.person.email()[1]
- if e:
- receivers.append(e)
-
- receivers.append("%s@%s" % (doc.filename, settings.TOOLS_SERVER))
- return ", ".join(receivers)
-
-def get_new_ballot_id():
- return IDInternal.objects.aggregate(Max('ballot'))['ballot__max'] + 1
-
-@group_required('Area_Director','Secretariat')
-def edit_info(request, name):
- pass
-
-class EditInfoFormREDESIGN(forms.Form):
intended_std_level = forms.ModelChoiceField(IntendedStdLevelName.objects.filter(used=True), empty_label="(None)", required=True, label="Intended RFC status")
area = forms.ModelChoiceField(Group.objects.filter(type="area", state="active"), empty_label="(None - individual submission)", required=False, label="Assigned to area")
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'), label="Responsible AD", empty_label="(None)", required=True)
@@ -421,8 +376,8 @@ def get_initial_notify(doc):
receivers.append("%s@%s" % (doc.name, settings.TOOLS_SERVER))
return ", ".join(receivers)
-@group_required('Area_Director','Secretariat')
-def edit_infoREDESIGN(request, name):
+@role_required('Area Director','Secretariat')
+def edit_info(request, name):
"""Edit various Internet Draft attributes, notifying parties as
necessary and logging changes as document events."""
doc = get_object_or_404(Document, docalias__name=name)
@@ -530,7 +485,7 @@ def edit_infoREDESIGN(request, name):
doc.time = datetime.datetime.now()
if changes and not new_document:
- email_owner(request, doc, orig_ad, login, "\n".join(changes))
+ email_ad(request, doc, orig_ad, login, "\n".join(changes))
doc.save()
return HttpResponseRedirect(doc.get_absolute_url())
@@ -552,7 +507,7 @@ def edit_infoREDESIGN(request, name):
if doc.group.type_id not in ("individ", "area"):
form.standard_fields = [x for x in form.standard_fields if x.name != "area"]
- return render_to_response('idrfc/edit_infoREDESIGN.html',
+ return render_to_response('idrfc/edit_info.html',
dict(doc=doc,
form=form,
user=request.user,
@@ -560,37 +515,8 @@ def edit_infoREDESIGN(request, name):
ballot_issued=doc.latest_event(type="sent_ballot_announcement")),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- EditInfoForm = EditInfoFormREDESIGN
- edit_info = edit_infoREDESIGN
-
-
-@group_required('Area_Director','Secretariat')
+@role_required('Area Director','Secretariat')
def request_resurrect(request, name):
- """Request resurrect of expired Internet Draft."""
- doc = get_object_or_404(InternetDraft, filename=name)
- if doc.status.status != "Expired":
- raise Http404()
-
- if not doc.idinternal:
- doc.idinternal = IDInternal(draft=doc, rfc_flag=type(doc) == Rfc)
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- if request.method == 'POST':
- email_resurrect_requested(request, doc, login)
- add_document_comment(request, doc, "Resurrection was requested")
- doc.idinternal.resurrect_requested_by = login
- doc.idinternal.save()
- return HttpResponseRedirect(doc.idinternal.get_absolute_url())
-
- return render_to_response('idrfc/request_resurrect.html',
- dict(doc=doc,
- back_url=doc.idinternal.get_absolute_url()),
- context_instance=RequestContext(request))
-
-@group_required('Area_Director','Secretariat')
-def request_resurrectREDESIGN(request, name):
"""Request resurrect of expired Internet Draft."""
doc = get_object_or_404(Document, docalias__name=name)
if doc.get_state_slug() != "expired":
@@ -613,39 +539,8 @@ def request_resurrectREDESIGN(request, name):
back_url=doc.get_absolute_url()),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- request_resurrect = request_resurrectREDESIGN
-
-@group_required('Secretariat')
+@role_required('Secretariat')
def resurrect(request, name):
- """Resurrect expired Internet Draft."""
- doc = get_object_or_404(InternetDraft, filename=name)
- if doc.status.status != "Expired":
- raise Http404()
-
- if not doc.idinternal:
- doc.idinternal = IDInternal(draft=doc, rfc_flag=type(doc) == Rfc)
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- if request.method == 'POST':
- if doc.idinternal.resurrect_requested_by:
- email_resurrection_completed(request, doc)
- add_document_comment(request, doc, "Resurrection was completed")
- doc.idinternal.resurrect_requested_by = None
- doc.idinternal.event_date = date.today()
- doc.idinternal.save()
- doc.status = IDStatus.objects.get(status="Active")
- doc.save()
- return HttpResponseRedirect(doc.idinternal.get_absolute_url())
-
- return render_to_response('idrfc/resurrect.html',
- dict(doc=doc,
- back_url=doc.idinternal.get_absolute_url()),
- context_instance=RequestContext(request))
-
-@group_required('Secretariat')
-def resurrectREDESIGN(request, name):
"""Resurrect expired Internet Draft."""
doc = get_object_or_404(Document, docalias__name=name)
if doc.get_state_slug() != "expired":
@@ -676,41 +571,11 @@ def resurrectREDESIGN(request, name):
back_url=doc.get_absolute_url()),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- resurrect = resurrectREDESIGN
-
-
class AddCommentForm(forms.Form):
comment = forms.CharField(required=True, widget=forms.Textarea)
-@group_required('Area_Director','Secretariat', 'IANA')
+@role_required('Area Director', 'Secretariat', 'IANA', 'RFC Editor')
def add_comment(request, name):
- """Add comment to Internet Draft."""
- doc = get_object_or_404(InternetDraft, filename=name)
- if not doc.idinternal:
- raise Http404()
-
- login = IESGLogin.objects.get(login_name=request.user.username)
-
- if request.method == 'POST':
- form = AddCommentForm(request.POST)
- if form.is_valid():
- c = form.cleaned_data['comment']
- add_document_comment(request, doc, c)
- email_owner(request, doc, doc.idinternal.job_owner, login,
- "A new comment added by %s" % login)
- return HttpResponseRedirect(doc.idinternal.get_absolute_url())
- else:
- form = AddCommentForm()
-
- return render_to_response('idrfc/add_comment.html',
- dict(doc=doc,
- form=form,
- back_url=doc.idinternal.get_absolute_url()),
- context_instance=RequestContext(request))
-
-@group_required('Area_Director', 'Secretariat', 'IANA', 'RFC Editor')
-def add_commentREDESIGN(request, name):
"""Add comment to history of document."""
doc = get_object_or_404(Document, docalias__name=name)
@@ -727,7 +592,7 @@ def add_commentREDESIGN(request, name):
e.save()
if doc.type_id == "draft":
- email_owner(request, doc, doc.ad, login,
+ email_ad(request, doc, doc.ad, login,
"A new comment added by %s" % login.name)
return HttpResponseRedirect(urlreverse("doc_history", kwargs=dict(name=doc.name)))
else:
@@ -738,14 +603,11 @@ def add_commentREDESIGN(request, name):
form=form),
context_instance=RequestContext(request))
-if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- add_comment = add_commentREDESIGN
-
class NotifyForm(forms.Form):
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
-@group_required('Area_Director','Secretariat')
+@role_required('Area Director', 'Secretariat')
def edit_notices(request, name):
"""Change the set of email addresses document change notificaitions go to."""
@@ -802,7 +664,7 @@ class TelechatForm(forms.Form):
self.fields['telechat_date'].choices = [("", "(not on agenda)")] + [(d, d.strftime("%Y-%m-%d")) for d in dates]
-@group_required("Area Director", "Secretariat")
+@role_required("Area Director", "Secretariat")
def telechat_date(request, name):
doc = get_object_or_404(Document, type="draft", name=name)
login = request.user.get_profile()
@@ -838,7 +700,7 @@ class IESGNoteForm(forms.Form):
# that has caused a lot of pain in the past.
return self.cleaned_data['note'].replace('\r', '').strip()
-@group_required("Area Director", "Secretariat")
+@role_required("Area Director", "Secretariat")
def edit_iesg_note(request, name):
doc = get_object_or_404(Document, type="draft", name=name)
login = request.user.get_profile()
@@ -1011,7 +873,7 @@ class AdForm(forms.Form):
if ad_pk and ad_pk not in [pk for pk, name in choices]:
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).plain_name())]
-@group_required("Area Director", "Secretariat")
+@role_required("Area Director", "Secretariat")
def edit_ad(request, name):
"""Change the shepherding Area Director for this draft."""
diff --git a/ietf/iesg/tests.py b/ietf/iesg/tests.py
index 406bdb234..459c3f3ef 100644
--- a/ietf/iesg/tests.py
+++ b/ietf/iesg/tests.py
@@ -7,7 +7,6 @@ from django.conf import settings
from pyquery import PyQuery
-from ietf.idrfc.models import RfcIndex
from ietf.idtracker.models import *
from ietf.iesg.models import *
from ietf.utils.test_utils import SimpleUrlTestCase, RealDatabaseTest, canonicalize_feed, login_testing_unauthorized
diff --git a/ietf/iesg/views.py b/ietf/iesg/views.py
index 024221151..71e75edad 100644
--- a/ietf/iesg/views.py
+++ b/ietf/iesg/views.py
@@ -49,7 +49,6 @@ from django.utils import simplejson as json
from django import forms
from ietf.iesg.models import TelechatDates, TelechatAgendaItem, WGAction
from ietf.idrfc.idrfc_wrapper import IdWrapper, RfcWrapper
-from ietf.idrfc.models import RfcIndex
from ietf.idrfc.utils import update_telechat
from ietf.ietfauth.decorators import group_required, role_required
from ietf.idtracker.templatetags.ietf_filters import in_group
@@ -603,61 +602,27 @@ def telechat_docs_tarfile(request,year,month,day):
return response
def discusses(request):
- if settings.USE_DB_REDESIGN_PROXY_CLASSES:
- res = []
-
- for d in IDInternal.objects.filter(states__type="draft-iesg", states__slug__in=("pub-req", "ad-eval", "review-e", "lc-req", "lc", "writeupw", "goaheadw", "iesg-eva", "defer", "watching"), docevent__ballotpositiondocevent__pos="discuss").distinct():
- found = False
- for p in d.positions.all():
- if p.discuss:
- found = True
- break
-
- if not found:
- continue
-
- if d.rfc_flag:
- doc = RfcWrapper(d)
- else:
- doc = IdWrapper(draft=d)
-
- if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
- res.append(doc)
-
- return direct_to_template(request, 'iesg/discusses.html', {'docs':res})
-
- positions = Position.objects.filter(discuss=1)
res = []
- try:
- ids = set()
- except NameError:
- # for Python 2.3
- from sets import Set as set
- ids = set()
-
- for p in positions:
- try:
- draft = p.ballot.drafts.filter(primary_flag=1)
- if len(draft) > 0 and draft[0].rfc_flag:
- if not -draft[0].draft_id in ids:
- ids.add(-draft[0].draft_id)
- try:
- ri = RfcIndex.objects.get(rfc_number=draft[0].draft_id)
- doc = RfcWrapper(ri)
- if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
- res.append(doc)
- except RfcIndex.DoesNotExist:
- # NOT QUITE RIGHT, although this should never happen
- pass
- if len(draft) > 0 and not draft[0].rfc_flag and draft[0].draft.id_document_tag not in ids:
- ids.add(draft[0].draft.id_document_tag)
- doc = IdWrapper(draft=draft[0])
- if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
- res.append(doc)
- except IDInternal.DoesNotExist:
- pass
- return direct_to_template(request, 'iesg/discusses.html', {'docs':res})
+ for d in IDInternal.objects.filter(states__type="draft-iesg", states__slug__in=("pub-req", "ad-eval", "review-e", "lc-req", "lc", "writeupw", "goaheadw", "iesg-eva", "defer", "watching"), docevent__ballotpositiondocevent__pos="discuss").distinct():
+ found = False
+ for p in d.positions.all():
+ if p.discuss:
+ found = True
+ break
+
+ if not found:
+ continue
+
+ if d.rfc_flag:
+ doc = RfcWrapper(d)
+ else:
+ doc = IdWrapper(draft=d)
+
+ if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
+ res.append(doc)
+
+ return direct_to_template(request, 'iesg/discusses.html', {'docs':res})
@role_required('Area Director', 'Secretariat')
def milestones_needing_review(request):
diff --git a/ietf/secr/telechat/views.py b/ietf/secr/telechat/views.py
index 0de92237a..f0ab85c8c 100644
--- a/ietf/secr/telechat/views.py
+++ b/ietf/secr/telechat/views.py
@@ -14,7 +14,7 @@ from ietf.group.models import Group
from ietf.name.models import BallotPositionName
from ietf.person.models import Person
from ietf.idrfc.lastcall import request_last_call
-from ietf.idrfc.mails import email_owner, email_state_changed
+from ietf.idrfc.mails import email_ad, email_state_changed
from ietf.idrfc.utils import add_document_comment
from ietf.iesg.models import TelechatDate, TelechatAgendaItem, WGAction
from ietf.iesg.views import _agenda_data
@@ -291,7 +291,7 @@ def doc_detail(request, date, name):
doc.save()
email_state_changed(request, doc, e.desc)
- email_owner(request, doc, doc.ad, login, e.desc)
+ email_ad(request, doc, doc.ad, login, e.desc)
if state.slug == "lc-req":
request_last_call(request, doc)
diff --git a/ietf/sync/iana.py b/ietf/sync/iana.py
index 2d280210f..c795e70a5 100644
--- a/ietf/sync/iana.py
+++ b/ietf/sync/iana.py
@@ -6,7 +6,7 @@ from django.conf import settings
from ietf.doc.models import *
from ietf.doc.utils import add_state_change_event
from ietf.person.models import *
-from ietf.idrfc.mails import email_owner, email_state_changed, email_authors
+from ietf.idrfc.mails import email_ad, email_state_changed, email_authors
from ietf.utils.timezone import *
#PROTOCOLS_URL = "http://www.iana.org/protocols/"
@@ -200,7 +200,7 @@ def update_history_with_changes(changes, send_email=True):
if send_email and (state != prev_state):
email_state_changed(None, doc, "IANA %s state changed to %s" % (kind, state.name))
- email_owner(None, doc, doc.ad, system, "IANA %s state changed to %s" % (kind, state.name))
+ email_ad(None, doc, doc.ad, system, "IANA %s state changed to %s" % (kind, state.name))
if doc.time < timestamp:
doc.time = timestamp
diff --git a/ietf/templates/base_wgmenu.html b/ietf/templates/base_wgmenu.html
index 56144a08f..b32b9d2ca 100644
--- a/ietf/templates/base_wgmenu.html
+++ b/ietf/templates/base_wgmenu.html
@@ -32,9 +32,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% endcomment %}
{% for area in areas %}
-{% if area.area.active_wgs %}
-