# Inc. All Rights Reserved. ############################################################################### from pylons import g from r2.lib.validator.validator import ( VBoolean, VInt, VLang, VOneOf, ) # Validators that map directly to Account._preference_attrs # The key MUST be the same string as the value in _preference_attrs # Non-preference validators should be added to to the controller # method directly (see PostController.POST_options) PREFS_VALIDATORS = dict( pref_frame=VBoolean('frame'), pref_clickgadget=VBoolean('clickgadget'), pref_organic=VBoolean('organic'), pref_newwindow=VBoolean('newwindow'), pref_public_votes=VBoolean('public_votes'), pref_hide_from_robots=VBoolean('hide_from_robots'), pref_hide_ups=VBoolean('hide_ups'), pref_hide_downs=VBoolean('hide_downs'), pref_over_18=VBoolean('over_18'), pref_research=VBoolean('research'), pref_numsites=VInt('numsites', 1, 100), pref_lang=VLang('lang'), pref_media=VOneOf('media', ('on', 'off', 'subreddit')), pref_compress=VBoolean('compress'), pref_domain_details=VBoolean('domain_details'), pref_min_link_score=VInt('min_link_score', -100, 100),
VChatUser, VChatClientUser, VChatClientAuthToken, VSiteTheme, ) from r2.lib.errors import errors # CUSTOM from r2.models import Subreddit, NotFound, Account # Validators that map directly to Account._preference_attrs # The key MUST be the same string as the value in _preference_attrs # Non-preference validators should be added to to the controller # method directly (see PostController.POST_options) PREFS_VALIDATORS = dict( pref_clickgadget=VBoolean('clickgadget'), pref_organic=VBoolean('organic'), pref_newwindow=VBoolean('newwindow'), pref_public_votes=VBoolean('public_votes'), pref_hide_from_robots=VBoolean('hide_from_robots'), pref_hide_ups=VBoolean('hide_ups'), pref_hide_downs=VBoolean('hide_downs'), pref_over_18=VBoolean('over_18'), pref_research=VBoolean('research'), pref_numsites=VInt('numsites', 1, 100), pref_lang=VLang('lang'), pref_media=VOneOf('media', ('on', 'off', 'subreddit')), # pref_media_preview=VOneOf('media_preview', ('on', 'off', 'subreddit')), pref_compress=VBoolean('compress'), pref_domain_details=VBoolean('domain_details'), pref_min_link_score=VInt('min_link_score', -100, 100),