@user_merged.connect
def update_mailchimp_subscription(user, list_name, subscription, send_goodbye=True):
 if subscription:
  mailchimp_utils.subscribe_mailchimp(list_name, user._id)
 else:
  try:
   mailchimp_utils.unsubscribe_mailchimp_async(list_name, user._id, username=user.username, send_goodbye=send_goodbye)
  except mailchimp_utils.mailchimp.ListNotSubscribedError:
   raise HTTPError(http.BAD_REQUEST, data=dict(message_short='ListNotSubscribedError', message_long='The user is already unsubscribed from this mailing list.', error_type='not_subscribed'))

@ user_merged . connect def update_mailchimp_subscription ( user , list_name , subscription , send_goodbye = True ) : if subscription : mailchimp_utils . subscribe_mailchimp ( list_name , user . _id ) else : try : mailchimp_utils . unsubscribe_mailchimp_async ( list_name , user . _id , username = user . username , send_goodbye = send_goodbye ) except mailchimp_utils . mailchimp . ListNotSubscribedError : raise HTTPError ( http . BAD_REQUEST , data = dict ( message_short = 'ListNotSubscribedError' , message_long = 'The user is already unsubscribed from this mailing list.' , error_type = 'not_subscribed' ) )
update mailing list subscription in mailchimp .