refactoring well-known settings
[mygpo.git] / mygpo / users / settings.py
blob0bde2244b22f8922b46967d290efcd0c1f10c89f
1 from collections import namedtuple
3 from couchdbkit.ext.django.schema import *
6 WellKnownSetting = namedtuple('WellKnownSetting', 'name default')
8 ## Well-known settings
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)
27 # Flag to mark an episode as favorite
28 FAV_FLAG = WellKnownSetting('is_favorite', False)
32 class SettingsMixin(DocumentSchema):
33 """ Objects that have an Old-Id from the old MySQL backend """
35 settings = DictProperty()
38 def get_wksetting(self, setting):
39 """ returns the value of a well-known setting """
40 return self.settings.get(setting.name, setting.default)