#NEWLINE# def send_campaign( self , newsletter , list_id ) : #NEWLINE# #INDENT# if ( not DEFAULT_FROM_EMAIL ) : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'You have to specify a DEFAULT_FROM_EMAIL in Django settings.' ) #NEWLINE# #UNINDENT# if ( not DEFAULT_FROM_NAME ) : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'You have to specify a DEFAULT_FROM_NAME in Django settings.' ) #NEWLINE# #UNINDENT# old_language = translation . get_language ( ) #NEWLINE# language = settings . LANGUAGE_CODE #NEWLINE# if ( len ( old_language . languages ) == 1 ) : #NEWLINE# #INDENT# language = newsletter . languages [ 0 ] #NEWLINE# #UNINDENT# translation . activate ( language ) #NEWLINE# try : #NEWLINE# #INDENT# self . _send_campaign ( newsletter , list_id ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logger . exception ( e ) #NEWLINE# if ( not FAIL_SILENTLY ) : #NEWLINE# #INDENT# raise e #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# newsletter . sent = True #NEWLINE# update_fields ( newsletter , fields = ( 'sent' , ) ) #NEWLINE# #UNINDENT# translation . activate ( old_language )