1 from collections
import namedtuple
3 from couchdbkit
.ext
.django
.schema
import *
6 WellKnownSetting
= namedtuple('WellKnownSetting', 'name default')
9 # this should be documented at
10 # http://wiki.gpodder.org/wiki/Web_Services/API_2/Settings#Known_Settings
12 # Flag to allow storing of user-agents
13 STORE_UA
= WellKnownSetting('store_user_agent', True)
15 # Flag to mark a subscription as public
16 PUBLIC_SUB_PODCAST
= WellKnownSetting('public_subscription', True)
18 # Default public-flag value (stored in the podcast)
19 PUBLIC_SUB_USER
= WellKnownSetting('public_subscriptions', True)
21 # Flattr authentication token, empty if not logged in
22 FLATTR_TOKEN
= WellKnownSetting('flattr_token', '')
24 # enable auto-flattring
25 FLATTR_AUTO
= WellKnownSetting('auto_flattr', False)
28 FLATTR_MYGPO
= WellKnownSetting('flattr_mygpo', False)
30 # username for flattr buttons for own content
31 FLATTR_USERNAME
= WellKnownSetting('flattr_username', '')
33 # Flag to mark an episode as favorite
34 FAV_FLAG
= WellKnownSetting('is_favorite', False)
38 class SettingsMixin(DocumentSchema
):
39 """ Objects that have an Old-Id from the old MySQL backend """
41 settings
= DictProperty()
44 def get_wksetting(self
, setting
):
45 """ returns the value of a well-known setting """
46 return self
.settings
.get(setting
.name
, setting
.default
)