1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from django.conf import settings as settings
7 from catalogue.utils import AppSettings
10 default_app_config = 'catalogue.apps.CatalogueConfig'
13 class Settings(AppSettings):
14 """Default settings for catalogue app."""
15 DEFAULT_LANGUAGE = u'pol'
16 # PDF needs TeXML + XeLaTeX, MOBI needs Calibre.
17 DONT_BUILD = {'pdf', 'mobi'}
19 'epub': 'wolnelektury_pl_epub',
20 'pdf': 'wolnelektury_pl_pdf',
21 'mobi': 'wolnelektury_pl_mobi',
22 'fb2': 'wolnelektury_pl_fb2',
25 REDAKCJA_URL = "http://redakcja.wolnelektury.pl"
26 GOOD_LICENSES = {r'CC BY \d\.\d', r'CC BY-SA \d\.\d'}
27 RELATED_RANDOM_PICTURE_CHANCE = .5
29 def _more_DONT_BUILD(self, value):
30 for format_ in ['cover', 'pdf', 'epub', 'mobi', 'fb2', 'txt']:
31 attname = 'NO_BUILD_%s' % format_.upper()
32 if hasattr(settings, attname):
33 logging.warn("%s is deprecated, use CATALOGUE_DONT_BUILD instead", attname)
34 if getattr(settings, attname):
40 def _more_FORMAT_ZIPS(self, value):
41 for format_ in ['epub', 'pdf', 'mobi', 'fb2']:
42 attname = 'ALL_%s_ZIP' % format_.upper()
43 if hasattr(settings, attname):
44 logging.warn("%s is deprecated, use CATALOGUE_FORMAT_ZIPS[%s] instead", attname, format_)
45 value[format_] = getattr(settings, attname)
49 app_settings = Settings('CATALOGUE')