#NEWLINE# def mail_thankyou( self , request = None ) : #NEWLINE# #INDENT# '\n        Mail a thankyou note for a completed contribution.\n\n        Raises a ``ContributionError`` exception when the contribution\n        is not complete or email addresses are not found.\n        ' #NEWLINE# locale = self . _switch_locale ( ) #NEWLINE# if ( not self . addon . enable_thankyou ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( not self . transaction_id ) : #NEWLINE# #INDENT# raise ContributionError ( 'Transaction not complete' ) #NEWLINE# #UNINDENT# from_email = settings . DEFAULT_FROM_EMAIL #NEWLINE# if self . addon . support_email : #NEWLINE# #INDENT# from_email = str ( self . addon . support_email ) #NEWLINE# #UNINDENT# to_email = self . post_data [ 'payer_email' ] #NEWLINE# if ( not to_email ) : #NEWLINE# #INDENT# raise ContributionError ( 'Empty payer email' ) #NEWLINE# #UNINDENT# url_parts = self . addon . meet_the_dev_url ( ) . split ( '/' ) #NEWLINE# url_parts [ 1 ] = locale . language #NEWLINE# subject = _ ( 'Thanks for contributing to {addon_name}' ) . format ( addon_name = self . addon . name ) #NEWLINE# send_mail_jinja ( subject , 'stats/contribution-thankyou-email.ltxt' , { #NEWLINE# #INDENT# 'thankyou_note' : bleach . clean ( unicode ( self . addon . thankyou_note ) , strip = True ) , #NEWLINE# 'addon_name' : self . addon . name , #NEWLINE# 'learn_url' : ( '%s%s?src=emailinfo' % ( settings . SITE_URL , '/' . join ( url_parts ) ) ) , #NEWLINE# 'domain' : settings . DOMAIN , #NEWLINE# #UNINDENT# } , from_email , [ to_email ] , fail_silently = True , perm_setting = 'dev_thanks' )