Mercurial > piecrust2
diff foodtruck/views/dashboard.py @ 770:a7726e4862c4
admin: Fix API changes, don't crash the dashboard on non-binary WIP files.
Treat new/edited files that have no `auto_format` supported extension as
"miscellaneous" files, which are shown separately on the dashboard.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 02 Jul 2016 01:30:51 -0700 |
parents | 4d8e82641597 |
children | 3885421c29a3 |
line wrap: on
line diff
--- a/foodtruck/views/dashboard.py Sat Jul 02 01:28:29 2016 -0700 +++ b/foodtruck/views/dashboard.py Sat Jul 02 01:30:51 2016 -0700 @@ -39,16 +39,21 @@ data['new_pages'] = [] data['edited_pages'] = [] + data['misc_files'] = [] if site.scm: st = site.scm.getStatus() for p in st.new_files: pd = _getWipData(p, site, fs_endpoints) if pd: data['new_pages'].append(pd) + else: + data['misc_files'].append(p) for p in st.edited_files: pd = _getWipData(p, site, fs_endpoints) if pd: data['edited_pages'].append(pd) + else: + data['misc_files'].append(p) data['site_name'] = site.name data['site_title'] = site.piecrust_app.config.get('site/title', site.name) @@ -70,6 +75,11 @@ def _getWipData(path, site, fs_endpoints): + auto_formats = site.piecrust_app.config.get('site/auto_formats', ['html']) + pathname, pathext = os.path.splitext(path) + if pathext not in auto_formats: + return None + source = None for endpoint, s in fs_endpoints.items(): if path.startswith(endpoint): @@ -79,8 +89,7 @@ return None fac = source.buildPageFactory(os.path.join(site.root_dir, path)) - route = site.piecrust_app.getRoute( - source.name, fac.metadata, skip_taxonomies=True) + route = site.piecrust_app.getSourceRoute(source.name, fac.metadata) if not route: return None