def send_email_after_export(email, event_name, result):
 if ('__error' in result):
  send_email(email, action=EVENT_EXPORT_FAIL, subject=MAILS[EVENT_EXPORT_FAIL]['subject'].format(event_name=event_name), html=MAILS[EVENT_EXPORT_FAIL]['message'].format(error_text=result['result']['message']))
 else:
  send_email(email, action=EVENT_EXPORTED, subject=MAILS[EVENT_EXPORTED]['subject'].format(event_name=event_name), html=MAILS[EVENT_EXPORTED]['message'].format(download_url=(request.url_root.strip('/') + result['download_url'])))

def send_email_after_export ( email , event_name , result ) : if ( '__error' in result ) : send_email ( email , action = EVENT_EXPORT_FAIL , subject = MAILS [ EVENT_EXPORT_FAIL ] [ 'subject' ] . format ( event_name = event_name ) , html = MAILS [ EVENT_EXPORT_FAIL ] [ 'message' ] . format ( error_text = result [ 'result' ] [ 'message' ] ) ) else : send_email ( email , action = EVENT_EXPORTED , subject = MAILS [ EVENT_EXPORTED ] [ 'subject' ] . format ( event_name = event_name ) , html = MAILS [ EVENT_EXPORTED ] [ 'message' ] . format ( download_url = ( request . url_root . strip ( '/' ) + result [ 'download_url' ] ) ) )
send email after event export .