Mercurial > piecrust2
view piecrust/admin/views/preview.py @ 853:f070a4fc033c
core: Continue PieCrust3 refactor, simplify pages.
The asset pipeline is still the only function pipeline at this point.
* No more `QualifiedPage`, and several other pieces of code deleted.
* Data providers are simpler and more focused. For instance, the page iterator
doesn't try to support other types of items.
* Route parameters are proper known source metadata to remove the confusion
between the two.
* Make the baker and pipeline more correctly manage records and record
histories.
* Add support for record collapsing and deleting stale outputs in the asset
pipeline.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 21 May 2017 00:06:59 -0700 |
parents | 82509bce94ca |
children | dcdec4b951a1 |
line wrap: on
line source
from flask import current_app, g, make_response from flask.ext.login import login_required from piecrust.app import PieCrustFactory from piecrust.serving.server import Server from ..blueprint import foodtruck_bp @foodtruck_bp.route('/site/<sitename>/') @login_required def preview_site_root(sitename): return preview_site(sitename, '/') @foodtruck_bp.route('/site/<sitename>/<path:url>') @login_required def preview_site(sitename, url): root_dir = g.sites.get_root_dir(sitename) appfactory = PieCrustFactory( root_dir, cache_key='foodtruck', debug=current_app.debug) server = Server(appfactory, root_url='/site/%s/' % sitename) return make_response(server._run_request)