@task(bind=True, default_retry_delay=3600, max_retries=24)
def update_user(self, sailthru_vars, email, site=None, new_user=False, activation=False):
 email_config = EmailMarketingConfiguration.current()
 if (not email_config.enabled):
  return
 sailthru_client = SailthruClient(email_config.sailthru_key, email_config.sailthru_secret)
 try:
  sailthru_response = sailthru_client.api_post('user', _create_email_user_param(sailthru_vars, sailthru_client, email, new_user, email_config, site=site))
 except SailthruClientError as exc:
  log.error('Exception attempting to add/update user %s in Sailthru - %s', email, unicode(exc))
  raise self.retry(exc=exc, countdown=email_config.sailthru_retry_interval, max_retries=email_config.sailthru_max_retries)
 if (not sailthru_response.is_ok()):
  error = sailthru_response.get_error()
  log.error('Error attempting to add/update user in Sailthru: %s', error.get_message())
  if _retryable_sailthru_error(error):
   raise self.retry(countdown=email_config.sailthru_retry_interval, max_retries=email_config.sailthru_max_retries)
  return
 if (activation and email_config.sailthru_activation_template):
  scheduled_datetime = (datetime.utcnow() + timedelta(seconds=email_config.welcome_email_send_delay))
  try:
   sailthru_response = sailthru_client.api_post('send', {'email': email, 'template': email_config.sailthru_activation_template, 'schedule_time': scheduled_datetime.strftime('%Y-%m-%dT%H:%M:%SZ')})
  except SailthruClientError as exc:
   log.error('Exception attempting to send welcome email to user %s in Sailthru - %s', email, unicode(exc))
   raise self.retry(exc=exc, countdown=email_config.sailthru_retry_interval, max_retries=email_config.sailthru_max_retries)
  if (not sailthru_response.is_ok()):
   error = sailthru_response.get_error()
   log.error('Error attempting to send welcome email to user in Sailthru: %s', error.get_message())
   if _retryable_sailthru_error(error):
    raise self.retry(countdown=email_config.sailthru_retry_interval, max_retries=email_config.sailthru_max_retries)

@ task ( bind = True , default_retry_delay = 3600 , max_retries = 24 ) def update_user ( self , sailthru_vars , email , site = None , new_user = False , activation = False ) : email_config = EmailMarketingConfiguration . current ( ) if ( not email_config . enabled ) : return sailthru_client = SailthruClient ( email_config . sailthru_key , email_config . sailthru_secret ) try : sailthru_response = sailthru_client . api_post ( 'user' , _create_email_user_param ( sailthru_vars , sailthru_client , email , new_user , email_config , site = site ) ) except SailthruClientError as exc : log . error ( 'Exception attempting to add/update user %s in Sailthru - %s' , email , unicode ( exc ) ) raise self . retry ( exc = exc , countdown = email_config . sailthru_retry_interval , max_retries = email_config . sailthru_max_retries ) if ( not sailthru_response . is_ok ( ) ) : error = sailthru_response . get_error ( ) log . error ( 'Error attempting to add/update user in Sailthru: %s' , error . get_message ( ) ) if _retryable_sailthru_error ( error ) : raise self . retry ( countdown = email_config . sailthru_retry_interval , max_retries = email_config . sailthru_max_retries ) return if ( activation and email_config . sailthru_activation_template ) : scheduled_datetime = ( datetime . utcnow ( ) + timedelta ( seconds = email_config . welcome_email_send_delay ) ) try : sailthru_response = sailthru_client . api_post ( 'send' , { 'email' : email , 'template' : email_config . sailthru_activation_template , 'schedule_time' : scheduled_datetime . strftime ( '%Y-%m-%dT%H:%M:%SZ' ) } ) except SailthruClientError as exc : log . error ( 'Exception attempting to send welcome email to user %s in Sailthru - %s' , email , unicode ( exc ) ) raise self . retry ( exc = exc , countdown = email_config . sailthru_retry_interval , max_retries = email_config . sailthru_max_retries ) if ( not sailthru_response . is_ok ( ) ) : error = sailthru_response . get_error ( ) log . error ( 'Error attempting to send welcome email to user in Sailthru: %s' , error . get_message ( ) ) if _retryable_sailthru_error ( error ) : raise self . retry ( countdown = email_config . sailthru_retry_interval , max_retries = email_config . sailthru_max_retries )
update a users info from fxa if needed .