Mercurial > piecrust2
diff piecrust/admin/views/dashboard.py @ 935:7ecb946bfafd
admin: Lots of fixes for running the admin panel in a WSGI server.
- Use new source APIs in the dashboard to open WIP files.
- Fixed broken/outdated code in some views.
- Fixed cases when Flask is not running at the root URL by using the
`SCRIPT_NAME` variable somewhat more properly.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 04 Oct 2017 09:15:16 -0700 |
parents | 175d80cf75d7 |
children | 8101692fdc11 |
line wrap: on
line diff
--- a/piecrust/admin/views/dashboard.py Wed Oct 04 09:11:58 2017 -0700 +++ b/piecrust/admin/views/dashboard.py Wed Oct 04 09:15:16 2017 -0700 @@ -10,7 +10,7 @@ from piecrust.uriutil import split_uri from ..textutil import text_preview from ..blueprint import foodtruck_bp, load_user -from ..views import with_menu_context +from ..views import with_menu_context, with_base_data logger = logging.getLogger(__name__) @@ -87,7 +87,8 @@ if source is None: return None - content_item = source.findContentFromPath(path) + full_path = os.path.join(pcapp.root_dir, path) + content_item = source.findContentFromPath(full_path) if content_item is None: return None @@ -103,7 +104,7 @@ return { 'title': page.config.get('title'), 'slug': slug, - 'url': url_for('.edit_page', uri=slug), + 'url': url_for('.edit_page', url=slug), 'text': extract } @@ -126,6 +127,7 @@ "User '%s' doesn't exist or password is incorrect." % username) + with_base_data(data) return render_template('login.html', **data)