@intercept_errors(UserAPIInternalError, ignore_errors=[UserAPIRequestError])
def delete_user_preference(requesting_user, preference_key, username=None):
 existing_user = _get_authorized_user(requesting_user, username)
 try:
  user_preference = UserPreference.objects.get(user=existing_user, key=preference_key)
 except ObjectDoesNotExist:
  return False
 try:
  user_preference.delete()
 except Exception as error:
  raise PreferenceUpdateError(developer_message=u"Delete failed for user preference '{preference_key}': {error}".format(preference_key=preference_key, error=error), user_message=_(u"Delete failed for user preference '{preference_key}'.").format(preference_key=preference_key))
 return True

@ intercept_errors ( UserAPIInternalError , ignore_errors = [ UserAPIRequestError ] ) def delete_user_preference ( requesting_user , preference_key , username = None ) : existing_user = _get_authorized_user ( requesting_user , username ) try : user_preference = UserPreference . objects . get ( user = existing_user , key = preference_key ) except ObjectDoesNotExist : return False try : user_preference . delete ( ) except Exception as error : raise PreferenceUpdateError ( developer_message = u"Delete failed for user preference '{preference_key}': {error}" . format ( preference_key = preference_key , error = error ) , user_message = _ ( u"Delete failed for user preference '{preference_key}'." ) . format ( preference_key = preference_key ) ) return True
deletes a user preference on behalf of a requesting user .