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 class Settings(AppSettings):
11 """Default settings for catalogue app."""
12 DEFAULT_LANGUAGE = u'pol'
13 # PDF needs TeXML + XeLaTeX, MOBI needs Calibre.
14 DONT_BUILD = {'pdf', 'mobi'}
16 'epub': 'wolnelektury_pl_epub',
17 'pdf': 'wolnelektury_pl_pdf',
18 'mobi': 'wolnelektury_pl_mobi',
19 'fb2': 'wolnelektury_pl_fb2',
22 def _more_DONT_BUILD(self, value):
23 for format_ in ['cover', 'pdf', 'epub', 'mobi', 'fb2', 'txt']:
24 attname = 'NO_BUILD_%s' % format_.upper()
25 if hasattr(settings, attname):
26 logging.warn("%s is deprecated, "
27 "use CATALOGUE_DONT_BUILD instead", attname)
28 if getattr(settings, attname):
34 def _more_FORMAT_ZIPS(self, value):
35 for format_ in ['epub', 'pdf', 'mobi', 'fb2']:
36 attname = 'ALL_%s_ZIP' % format_.upper()
37 if hasattr(settings, attname):
38 logging.warn("%s is deprecated, "
39 "use CATALOGUE_FORMAT_ZIPS[%s] instead",
41 value[format_] = getattr(settings, attname)
45 app_settings = Settings('CATALOGUE')