original_docstring: Subscribe a user to Basket.
  
      This task subscribes a user to Basket, if not already subscribed
      and then updates his data on the Phonebook DataExtension. The task
      retries on failure at most BASKET_TASK_MAX_RETRIES times and if it
      finally doesn't complete successfully, it emails the
      settings.BASKET_MANAGERS with details.
      
docstring: Subscribe a user to Basket.
  This task subscribes a user to Basket, if not already subscribed
  and then updates his data on the Phonebook DataExtension. The task
  retries on failure at most BASKET_TASK_MAX_RETRIES times and if it
  finally doesn't complete successfully, it emails the
  settings.BASKET_MANAGERS with details.
docstring_tokens: Subscribe a user to Basket . This task subscribes a user to Basket if not already subscribed and then updates his data on the Phonebook DataExtension . The task retries on failure at most BASKET_TASK_MAX_RETRIES times and if it finally doesn ' t complete successfully it emails the settings . BASKET_MANAGERS with details .
code: def subscribe_user_to_basket(instance_id, newsletters=[]):
      """Subscribe a user to Basket.
  
      This task subscribes a user to Basket, if not already subscribed
      and then updates his data on the Phonebook DataExtension. The task
      retries on failure at most BASKET_TASK_MAX_RETRIES times and if it
      finally doesn't complete successfully, it emails the
      settings.BASKET_MANAGERS with details.
      """
  
      from mozillians.users.models import UserProfile
      try:
          instance = UserProfile.objects.get(pk=instance_id)
      except UserProfile.DoesNotExist:
          instance = None
  
      if (not BASKET_ENABLED or not instance or not newsletters
              or not waffle.switch_is_active('BASKET_SWITCH_ENABLED')):
          return
  
      lookup_subtask = lookup_user_task.subtask((instance.email,))
      subscribe_subtask = subscribe_user_task.subtask((instance.email, newsletters,))
      chain(lookup_subtask | subscribe_subtask)()
code_tokens: def subscribe_user_to_basket ( instance_id , newsletters = [ ] ) : from mozillians . users . models import UserProfile try : instance = UserProfile . objects . get ( pk = instance_id ) except UserProfile . DoesNotExist : instance = None if ( not BASKET_ENABLED or not instance or not newsletters or not waffle . switch_is_active ( 'BASKET_SWITCH_ENABLED' ) ) : return lookup_subtask = lookup_user_task . subtask ( ( instance . email , ) ) subscribe_subtask = subscribe_user_task . subtask ( ( instance . email , newsletters , ) ) chain ( lookup_subtask | subscribe_subtask ) ( )
short_docstring: Subscribe a user to Basket.
short_docstring_tokens: Subscribe a user to Basket .
comment: """Subscribe a user to Basket.
  
      This task subscribes a user to Basket, if not already subscribed
      and then updates his data on the Phonebook DataExtension. The task
      retries on failure at most BASKET_TASK_MAX_RETRIES times and if it
      finally doesn't complete successfully, it emails the
      settings.BASKET_MANAGERS with details.
      """