Mercurial > piecrust2
comparison piecrust/app.py @ 260:07b4b8484c0a
sources: Use `posts_*` and `items_*` settings more appropriately.
The `items_*` settings are the generic ones, and the `posts_*` are only used
with the default content model.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 23 Feb 2015 21:19:20 -0800 |
parents | e6ae65212c32 |
children | 12657039c436 |
comparison
equal
deleted
inserted
replaced
259:adb066ffb363 | 260:07b4b8484c0a |
---|---|
171 if not isinstance(sitec['plugins_sources'], list): | 171 if not isinstance(sitec['plugins_sources'], list): |
172 sitec['plugins_sources'] = [sitec['plugins_sources']] | 172 sitec['plugins_sources'] = [sitec['plugins_sources']] |
173 if not isinstance(sitec['themes_sources'], list): | 173 if not isinstance(sitec['themes_sources'], list): |
174 sitec['themes_sources'] = [sitec['themes_sources']] | 174 sitec['themes_sources'] = [sitec['themes_sources']] |
175 | 175 |
176 # Setup values for posts/items. | |
177 ipp = sitec.get('posts_per_page') | |
178 if ipp is not None: | |
179 sitec.setdefault('items_per_page', ipp) | |
180 pf = sitec.get('posts_filters') | |
181 if pf is not None: | |
182 sitec.setdefault('items_filters', pf) | |
183 | |
184 # Figure out if we need to validate sources/routes, or auto-generate | 176 # Figure out if we need to validate sources/routes, or auto-generate |
185 # them from simple blog settings. | 177 # them from simple blog settings. |
186 orig_sources = sitec.get('sources') | 178 orig_sources = sitec.get('sources') |
187 orig_routes = sitec.get('routes') | 179 orig_routes = sitec.get('routes') |
188 orig_taxonomies = sitec.get('taxonomies') | 180 orig_taxonomies = sitec.get('taxonomies') |
195 blogsc = sitec.setdefault('blogs', ['posts']) | 187 blogsc = sitec.setdefault('blogs', ['posts']) |
196 | 188 |
197 g_post_url = sitec.get('post_url', '%year%/%month%/%day%/%slug%') | 189 g_post_url = sitec.get('post_url', '%year%/%month%/%day%/%slug%') |
198 g_tag_url = sitec.get('tag_url', 'tag/%tag%') | 190 g_tag_url = sitec.get('tag_url', 'tag/%tag%') |
199 g_category_url = sitec.get('category_url', '%category%') | 191 g_category_url = sitec.get('category_url', '%category%') |
200 g_posts_per_page = sitec.get('items_per_page', 5) | 192 g_posts_per_page = sitec.get('posts_per_page', 5) |
201 g_posts_filters = sitec.get('items_filters') | 193 g_posts_filters = sitec.get('posts_filters') |
202 g_date_format = sitec.get('date_format', DEFAULT_DATE_FORMAT) | 194 g_date_format = sitec.get('date_format', DEFAULT_DATE_FORMAT) |
203 | 195 |
204 # The normal pages and tags/categories. | 196 # The normal pages and tags/categories. |
205 sourcesc = collections.OrderedDict() | 197 sourcesc = collections.OrderedDict() |
206 sourcesc['pages'] = { | 198 sourcesc['pages'] = { |