@@ -170,7 +170,7 @@ def get_fullcc_list(draft):
170170
171171 return ',' .join (result_list )
172172
173- def get_email_initial (draft , type = None , input = None ):
173+ def get_email_initial (draft , action = None , input = None ):
174174 """
175175 Takes a draft object, a string representing the email type:
176176 (extend,new,replace,resurrect,revision,update,withdraw) and
@@ -182,20 +182,22 @@ def get_email_initial(draft, type=None, input=None):
182182 It appears datatracker abbreviates the list with "et al". Datatracker scheduled_announcement
183183 entries have "Action" in subject whereas this app uses "ACTION"
184184 """
185- # assert False, (draft, type, input)
186185 expiration_date = (datetime .date .today () + datetime .timedelta (185 )).strftime ('%B %d, %Y' )
187186 new_revision = str (int (draft .rev )+ 1 ).zfill (2 )
188187 new_filename = draft .name + '-' + new_revision + '.txt'
189188 curr_filename = draft .name + '-' + draft .rev + '.txt'
190189 data = {}
191190 data ['cc' ] = get_fullcc_list (draft )
192191 data ['to' ] = ''
193- if type == 'extend' :
192+ data ['action' ] = action
193+
194+ if action == 'extend' :
194195 context = {'doc' :curr_filename ,'expire_date' :input ['expiration_date' ]}
195196 data ['subject' ] = 'Extension of Expiration Date for %s' % (curr_filename )
196197 data ['body' ] = render_to_string ('drafts/message_extend.txt' , context )
198+ data ['expiration_date' ] = input ['expiration_date' ]
197199
198- elif type == 'new' :
200+ elif action == 'new' :
199201 # if the ID belongs to a group other than "none" add line to message body
200202 if draft .group .type .slug == 'wg' :
201203 wg_message = 'This draft is a work item of the %s Working Group of the IETF.' % draft .group .name
@@ -211,37 +213,43 @@ def get_email_initial(draft, type=None, input=None):
211213 data ['subject' ] = 'I-D ACTION:%s' % (curr_filename )
212214 data ['body' ] = render_to_string ('drafts/message_new.txt' , context )
213215
214- elif type == 'replace' :
216+ elif action == 'replace' :
215217 '''
216218 input['replaced'] is a DocAlias
217219 input['replaced_by'] is a Document
218220 '''
219- context = {'doc' :input ['replaced' ]. name ,'replaced_by' :input ['replaced_by' ]. name }
220- data ['subject' ] = 'Replacement of %s with %s' % (input ['replaced' ]. name ,input ['replaced_by' ]. name )
221+ context = {'doc' :input ['replaced' ],'replaced_by' :input ['replaced_by' ]}
222+ data ['subject' ] = 'Replacement of %s with %s' % (input ['replaced' ],input ['replaced_by' ])
221223 data ['body' ] = render_to_string ('drafts/message_replace.txt' , context )
222-
223- elif type == 'resurrect' :
224+ data ['replaced' ] = input ['replaced' ]
225+ data ['replaced_by' ] = input ['replaced_by' ]
226+
227+ elif action == 'resurrect' :
224228 last_revision = get_last_revision (draft .name )
225229 last_filename = draft .name + '-' + last_revision + '.txt'
226230 context = {'doc' :last_filename ,'expire_date' :expiration_date }
227231 data ['subject' ] = 'Resurrection of %s' % (last_filename )
228232 data ['body' ] = render_to_string ('drafts/message_resurrect.txt' , context )
233+ data ['action' ] = action
229234
230- elif type == 'revision' :
235+ elif action == 'revision' :
231236 context = {'rev' :new_revision ,'doc' :new_filename ,'doc_base' :new_filename [:- 4 ]}
232237 data ['to' ] = get_revision_emails (draft )
233238 data ['cc' ] = ''
234239 data ['subject' ] = 'New Version Notification - %s' % (new_filename )
235240 data ['body' ] = render_to_string ('drafts/message_revision.txt' , context )
236241
237- elif type == 'update' :
242+ elif action == 'update' :
238243 context = {'doc' :input ['filename' ],'expire_date' :expiration_date }
239244 data ['subject' ] = 'Posting of %s' % (input ['filename' ])
240245 data ['body' ] = render_to_string ('drafts/message_update.txt' , context )
241-
242- elif type == 'withdraw' :
243- context = {'doc' :curr_filename ,'by' :input ['type' ]}
246+ data ['action' ] = action
247+
248+ elif action == 'withdraw' :
249+ context = {'doc' :curr_filename ,'by' :input ['withdraw_type' ]}
244250 data ['subject' ] = 'Withdrawl of %s' % (curr_filename )
245251 data ['body' ] = render_to_string ('drafts/message_withdraw.txt' , context )
252+ data ['action' ] = action
253+ data ['withdraw_type' ] = input ['withdraw_type' ]
246254
247255 return data
0 commit comments