99from django .core .urlresolvers import reverse as urlreverse
1010
1111from ietf .utils .mail import send_mail , send_mail_text
12- from ietf .idtracker .models import *
1312from ietf .ipr .search import iprs_from_docs , related_docs
14- #from ietf.doc.models import *
1513from ietf .doc .models import WriteupDocEvent , BallotPositionDocEvent , LastCallDocEvent , DocAlias , ConsensusDocEvent
1614from ietf .person .models import Person
17- from ietf .group .models import Group
15+ from ietf .group .models import Group , Role
1816
1917def email_state_changed (request , doc , text ):
20- to = [x .strip () for x in doc .idinternal .state_change_notice_to .replace (';' , ',' ).split (',' )]
21- if to :
22- send_mail (request , to , None ,
23- "ID Tracker State Update Notice: %s" % doc .file_tag (),
24- "idrfc/state_changed_email.txt" ,
25- dict (text = text ,
26- url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()))
27-
28- def email_state_changedREDESIGN (request , doc , text ):
2918 to = [x .strip () for x in doc .notify .replace (';' , ',' ).split (',' )]
3019 if not to :
3120 return
@@ -37,25 +26,21 @@ def email_state_changedREDESIGN(request, doc, text):
3726 dict (text = text ,
3827 url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()))
3928
40- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
41- email_state_changed = email_state_changedREDESIGN
42-
4329def email_stream_changed (request , doc , old_stream , new_stream , text = "" ):
4430 """Email the change text to the notify group and to the stream chairs"""
4531 to = [x .strip () for x in doc .notify .replace (';' , ',' ).split (',' )]
46- from ietf .group .models import Role as RedesignRole
4732
4833 # These use comprehension to deal with conditions when there might be more than one chair listed for a stream
4934 if old_stream :
50- to .extend ([x .person .formatted_email () for x in RedesignRole .objects .filter (group__acronym = old_stream .slug ,name = 'chair' )])
35+ to .extend ([x .person .formatted_email () for x in Role .objects .filter (group__acronym = old_stream .slug ,name = 'chair' )])
5136 if new_stream :
52- to .extend ([x .person .formatted_email () for x in RedesignRole .objects .filter (group__acronym = new_stream .slug ,name = 'chair' )])
37+ to .extend ([x .person .formatted_email () for x in Role .objects .filter (group__acronym = new_stream .slug ,name = 'chair' )])
5338
5439 if not to :
5540 return
5641
5742 if not text :
58- text = u"Stream changed to <b>%s</b> from %s" % (new_stream ,old_stream )
43+ text = u"Stream changed to <b>%s</b> from %s" % (new_stream , old_stream )
5944 text = strip_tags (text )
6045
6146 send_mail (request , to , None ,
@@ -86,20 +71,7 @@ def email_authors(request, doc, subject, text):
8671def html_to_text (html ):
8772 return strip_tags (html .replace ("<" , "<" ).replace (">" , ">" ).replace ("&" , "&" ).replace ("<br>" , "\n " ))
8873
89- def email_owner (request , doc , owner , changed_by , text , subject = None ):
90- if not owner or not changed_by or owner == changed_by :
91- return
92-
93- to = u"%s <%s>" % owner .person .email ()
94- send_mail (request , to ,
95- "DraftTracker Mail System <iesg-secretary@ietf.org>" ,
96- "%s updated by %s" % (doc .file_tag (), changed_by ),
97- "idrfc/change_notice.txt" ,
98- dict (text = html_to_text (text ),
99- doc = doc ,
100- url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()))
101-
102- def email_adREDESIGN (request , doc , ad , changed_by , text , subject = None ):
74+ def email_ad (request , doc , ad , changed_by , text , subject = None ):
10375 if not ad or not changed_by or ad == changed_by :
10476 return
10577
@@ -112,9 +84,6 @@ def email_adREDESIGN(request, doc, ad, changed_by, text, subject=None):
11284 doc = doc ,
11385 url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()))
11486
115- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
116- email_owner = email_adREDESIGN
117-
11887
11988def generate_ballot_writeup (request , doc ):
12089 e = doc .latest_event (type = "iana_review" )
@@ -131,10 +100,6 @@ def generate_ballot_writeup(request, doc):
131100 return e
132101
133102def generate_last_call_announcement (request , doc ):
134- pass
135-
136- def generate_last_call_announcementREDESIGN (request , doc ):
137-
138103 expiration_date = date .today () + timedelta (days = 14 )
139104 cc = []
140105 if doc .group .type_id in ("individ" , "area" ):
@@ -177,18 +142,9 @@ def generate_last_call_announcementREDESIGN(request, doc):
177142 return e
178143
179144
180- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
181- generate_last_call_announcement = generate_last_call_announcementREDESIGN
182-
183- def generate_approval_mail (request , doc ):
184- pass
185-
186- def generate_approval_mail_rfc_editor (request , doc ):
187- pass
188-
189145DO_NOT_PUBLISH_IESG_STATES = ("nopubadw" , "nopubanw" )
190146
191- def generate_approval_mailREDESIGN (request , doc ):
147+ def generate_approval_mail (request , doc ):
192148 if doc .get_state_slug ("draft-iesg" ) in DO_NOT_PUBLISH_IESG_STATES or doc .stream_id in ('ise' ,'irtf' ):
193149 mail = generate_approval_mail_rfc_editor (request , doc )
194150 else :
@@ -253,7 +209,7 @@ def generate_approval_mail_approved(request, doc):
253209 )
254210 )
255211
256- def generate_approval_mail_rfc_editorREDESIGN (request , doc ):
212+ def generate_approval_mail_rfc_editor (request , doc ):
257213 disapproved = doc .get_state_slug ("draft-iesg" ) in DO_NOT_PUBLISH_IESG_STATES
258214 doc_type = "RFC" if doc .get_state_slug () == "rfc" else "Internet Draft"
259215
@@ -281,10 +237,6 @@ def generate_approval_mail_rfc_editorREDESIGN(request, doc):
281237 )
282238 )
283239
284- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
285- generate_approval_mail = generate_approval_mailREDESIGN
286- generate_approval_mail_rfc_editor = generate_approval_mail_rfc_editorREDESIGN
287-
288240def generate_publication_request (request , doc ):
289241 group_description = ""
290242 if doc .group and doc .group .acronym != "none" :
@@ -310,18 +262,7 @@ def generate_publication_request(request, doc):
310262 )
311263 )
312264
313- def send_last_call_request (request , doc , ballot ):
314- to = "iesg-secretary@ietf.org"
315- frm = '"DraftTracker Mail System" <iesg-secretary@ietf.org>'
316- docs = [d .document () for d in doc .idinternal .ballot_set ()]
317-
318- send_mail (request , to , frm ,
319- "Last Call: %s" % doc .file_tag (),
320- "idrfc/last_call_request.txt" ,
321- dict (docs = docs ,
322- doc_url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()))
323-
324- def send_last_call_requestREDESIGN (request , doc ):
265+ def send_last_call_request (request , doc ):
325266 to = "iesg-secretary@ietf.org"
326267 frm = '"DraftTracker Mail System" <iesg-secretary@ietf.org>'
327268
@@ -331,21 +272,8 @@ def send_last_call_requestREDESIGN(request, doc):
331272 dict (docs = [doc ],
332273 doc_url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()))
333274
334- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
335- send_last_call_request = send_last_call_requestREDESIGN
336-
337275def email_resurrect_requested (request , doc , by ):
338276 to = "I-D Administrator <internet-drafts@ietf.org>"
339- frm = u"%s <%s>" % by .person .email ()
340- send_mail (request , to , frm ,
341- "I-D Resurrection Request" ,
342- "idrfc/resurrect_request_email.txt" ,
343- dict (doc = doc ,
344- by = frm ,
345- url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()))
346-
347- def email_resurrect_requestedREDESIGN (request , doc , by ):
348- to = "I-D Administrator <internet-drafts@ietf.org>"
349277
350278 if by .role_set .filter (name = "secr" , group__acronym = "secretariat" ):
351279 e = by .role_email ("secr" , group = "secretariat" )
@@ -360,20 +288,7 @@ def email_resurrect_requestedREDESIGN(request, doc, by):
360288 by = frm ,
361289 url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()))
362290
363- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
364- email_resurrect_requested = email_resurrect_requestedREDESIGN
365-
366- def email_resurrection_completed (request , doc ):
367- to = u"%s <%s>" % doc .idinternal .resurrect_requested_by .person .email ()
368- frm = "I-D Administrator <internet-drafts-reply@ietf.org>"
369- send_mail (request , to , frm ,
370- "I-D Resurrection Completed - %s" % doc .file_tag (),
371- "idrfc/resurrect_completed_email.txt" ,
372- dict (doc = doc ,
373- by = frm ,
374- url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()))
375-
376- def email_resurrection_completedREDESIGN (request , doc , requester ):
291+ def email_resurrection_completed (request , doc , requester ):
377292 if requester .role_set .filter (name = "secr" , group__acronym = "secretariat" ):
378293 e = requester .role_email ("secr" , group = "secretariat" )
379294 else :
@@ -388,9 +303,6 @@ def email_resurrection_completedREDESIGN(request, doc, requester):
388303 by = frm ,
389304 url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()))
390305
391- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
392- email_resurrection_completed = email_resurrection_completedREDESIGN
393-
394306def email_ballot_deferred (request , doc , by , telechat_date ):
395307 to = "iesg@ietf.org"
396308 frm = "DraftTracker Mail System <iesg-secretary@ietf.org>"
@@ -401,10 +313,7 @@ def email_ballot_deferred(request, doc, by, telechat_date):
401313 by = by ,
402314 telechat_date = telechat_date ))
403315
404- def generate_issue_ballot_mail (request , doc ):
405- pass
406-
407- def generate_issue_ballot_mailREDESIGN (request , doc , ballot ):
316+ def generate_issue_ballot_mail (request , doc , ballot ):
408317 active_ads = Person .objects .filter (role__name = "ad" , role__group__state = "active" ).distinct ()
409318
410319 positions = BallotPositionDocEvent .objects .filter (doc = doc , type = "changed_ballot_position" , ballot = ballot ).order_by ("-time" , '-id' ).select_related ('ad' )
@@ -456,7 +365,7 @@ def formatted(val):
456365 e = doc .latest_event (WriteupDocEvent , type = "changed_ballot_writeup_text" )
457366 ballot_writeup = e .text if e else ""
458367
459- return render_to_string ("idrfc/issue_ballot_mailREDESIGN .txt" ,
368+ return render_to_string ("idrfc/issue_ballot_mail .txt" ,
460369 dict (doc = doc ,
461370 doc_url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url (),
462371 active_ad_positions = active_ad_positions ,
@@ -468,9 +377,6 @@ def formatted(val):
468377 )
469378 )
470379
471- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
472- generate_issue_ballot_mail = generate_issue_ballot_mailREDESIGN
473-
474380def email_iana (request , doc , to , msg ):
475381 # fix up message and send it with extra info on doc in headers
476382 import email
@@ -494,19 +400,6 @@ def extra_automation_headers(doc):
494400 return extra
495401
496402def email_last_call_expired (doc ):
497- text = "IETF Last Call has ended, and the state has been changed to\n %s." % doc .idinternal .cur_state .state
498-
499- send_mail (None ,
500- "iesg@ietf.org" ,
501- "DraftTracker Mail System <iesg-secretary@ietf.org>" ,
502- "Last Call Expired: %s" % doc .file_tag (),
503- "idrfc/change_notice.txt" ,
504- dict (text = text ,
505- doc = doc ,
506- url = settings .IDTRACKER_BASE_URL + doc .idinternal .get_absolute_url ()),
507- cc = "iesg-secretary@ietf.org" )
508-
509- def email_last_call_expiredREDESIGN (doc ):
510403 text = "IETF Last Call has ended, and the state has been changed to\n %s." % doc .get_state ("draft-iesg" ).name
511404
512405 to = [x .strip () for x in doc .notify .replace (';' , ',' ).split (',' )]
@@ -521,7 +414,3 @@ def email_last_call_expiredREDESIGN(doc):
521414 doc = doc ,
522415 url = settings .IDTRACKER_BASE_URL + doc .get_absolute_url ()),
523416 cc = "iesg-secretary@ietf.org" )
524-
525- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
526- email_last_call_expired = email_last_call_expiredREDESIGN
527-
0 commit comments