Mercurial > piecrust2
comparison piecrust/app.py @ 31:8c15fc45d712
Make sure `.html` is part of auto-formats.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 19 Aug 2014 12:48:00 -0700 |
parents | 3701daa97927 |
children | 485682a6de50 |
comparison
equal
deleted
inserted
replaced
30:4bd840ae75cd | 31:8c15fc45d712 |
---|---|
22 | 22 |
23 | 23 |
24 logger = logging.getLogger(__name__) | 24 logger = logging.getLogger(__name__) |
25 | 25 |
26 | 26 |
27 CACHE_VERSION = 10 | 27 CACHE_VERSION = 11 |
28 | 28 |
29 | 29 |
30 class VariantNotFoundError(Exception): | 30 class VariantNotFoundError(Exception): |
31 def __init__(self, variant_path, message=None): | 31 def __init__(self, variant_path, message=None): |
32 super(VariantNotFoundError, self).__init__( | 32 super(VariantNotFoundError, self).__init__( |
130 values['__cache'] = cachec | 130 values['__cache'] = cachec |
131 | 131 |
132 # Cache auto-format regexes. | 132 # Cache auto-format regexes. |
133 if not isinstance(sitec['auto_formats'], dict): | 133 if not isinstance(sitec['auto_formats'], dict): |
134 raise ConfigurationError("The 'site/auto_formats' setting must be a dictionary.") | 134 raise ConfigurationError("The 'site/auto_formats' setting must be a dictionary.") |
135 html_auto_format = sitec['auto_formats'] | |
136 if not html_auto_format: | |
137 sitec['auto_formats']['html'] = sitec['default_format'] | |
135 cachec['auto_formats_re'] = r"\.(%s)$" % ( | 138 cachec['auto_formats_re'] = r"\.(%s)$" % ( |
136 '|'.join( | 139 '|'.join( |
137 [re.escape(i) for i in list(sitec['auto_formats'].keys())])) | 140 [re.escape(i) for i in list(sitec['auto_formats'].keys())])) |
138 if sitec['default_auto_format'] not in sitec['auto_formats']: | 141 if sitec['default_auto_format'] not in sitec['auto_formats']: |
139 raise ConfigurationError("Default auto-format '%s' is not declared." % sitec['default_auto_format']) | 142 raise ConfigurationError("Default auto-format '%s' is not declared." % sitec['default_auto_format']) |