comparison piecrust/admin/views/create.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 942565723e99
children 18d6ac20a132
comparison
equal deleted inserted replaced
934:98430e7143d2 935:7ecb946bfafd
2 from flask import ( 2 from flask import (
3 g, request, abort, render_template, url_for, redirect, flash) 3 g, request, abort, render_template, url_for, redirect, flash)
4 from flask.ext.login import login_required 4 from flask.ext.login import login_required
5 from piecrust.page import Page 5 from piecrust.page import Page
6 from piecrust.sources.interfaces import IInteractiveSource 6 from piecrust.sources.interfaces import IInteractiveSource
7 from piecrust.uriutil import split_uri
7 from ..blueprint import foodtruck_bp 8 from ..blueprint import foodtruck_bp
8 from ..views import with_menu_context 9 from ..views import with_menu_context
9 10
10 11
11 logger = logging.getLogger(__name__) 12 logger = logging.getLogger(__name__)
70 abort(500) 71 abort(500)
71 72
72 page = Page(source, content_item) 73 page = Page(source, content_item)
73 uri = page.getUri() 74 uri = page.getUri()
74 logger.debug("Redirecting to: %s" % uri) 75 logger.debug("Redirecting to: %s" % uri)
75 return redirect(url_for('.edit_page', uri=uri)) 76 _, rel_url = split_uri(page.app, uri)
77 return redirect(url_for('.edit_page', url=rel_url))
76 78