Exemplo n.º 1
0
    pref_threaded_messages=VBoolean("threaded_messages"),
    pref_collapse_read_messages=VBoolean("collapse_read_messages"),
    pref_email_messages=VBoolean("email_messages"),
    pref_private_feeds=VBoolean("private_feeds"),
    pref_store_visits=VBoolean('store_visits'),
    pref_hide_ads=VBoolean("hide_ads"),
    pref_show_trending=VBoolean("show_trending"),
    pref_highlight_new_comments=VBoolean("highlight_new_comments"),
    pref_show_gold_expiration=VBoolean("show_gold_expiration"),
    pref_monitor_mentions=VBoolean("monitor_mentions"),
    pref_hide_locationbar=VBoolean("hide_locationbar"),
    pref_use_global_defaults=VBoolean("use_global_defaults"),
    pref_creddit_autorenew=VBoolean("creddit_autorenew"),
    pref_enable_default_themes=VBoolean("enable_default_themes", False),
    pref_default_theme_sr=VSRByName("theme_selector",
                                    required=False,
                                    return_srname=True),
    pref_other_theme=VSRByName("other_theme",
                               required=False,
                               return_srname=True),
    pref_beta=VBoolean('beta'),
    pref_legacy_search=VBoolean('legacy_search'),
    pref_threaded_modmail=VBoolean('threaded_modmail', False),

    # SaidIt
    pref_chat_enabled=VBoolean("chat_enabled"),
    pref_chat_sidebar_size=VOneOf('chat_sidebar_size',
                                  ChatSidebarSizeMenu._options),
    # pref_chat_user=VChatUser('chat_user'),
    # pref_chat_client_user=VChatClientUser('chat_client_user'),
    # pref_chat_client_password=VChatClientAuthToken('chat_client_password'),
Exemplo n.º 2
0
    pref_mark_messages_read=VBoolean("mark_messages_read"),
    pref_threaded_messages=VBoolean("threaded_messages"),
    pref_collapse_read_messages=VBoolean("collapse_read_messages"),
    pref_email_messages=VBoolean("email_messages"),
    pref_private_feeds=VBoolean("private_feeds"),
    pref_store_visits=VBoolean('store_visits'),
    pref_hide_ads=VBoolean("hide_ads"),
    pref_show_trending=VBoolean("show_trending"),
    pref_highlight_new_comments=VBoolean("highlight_new_comments"),
    pref_show_gold_expiration=VBoolean("show_gold_expiration"),
    pref_monitor_mentions=VBoolean("monitor_mentions"),
    pref_hide_locationbar=VBoolean("hide_locationbar"),
    pref_use_global_defaults=VBoolean("use_global_defaults"),
    pref_creddit_autorenew=VBoolean("creddit_autorenew"),
    pref_enable_default_themes=VBoolean("enable_default_themes", False),
    pref_default_theme_sr=VSRByName("theme_selector", False),
    pref_other_theme=VSRByName("other_theme", False),
    pref_beta=VBoolean('beta'),
)


def set_prefs(user, prefs):
    for k, v in prefs.iteritems():
        if k == 'pref_beta' and v and not getattr(user, 'pref_beta', False):
            # If a user newly opted into beta, we want to subscribe them
            # to the beta subreddit.
            try:
                sr = Subreddit._by_name(g.beta_sr)
                sr.add_subscriber(user)
            except NotFound:
                g.log.warning("Could not find beta subreddit '%s'. It may "