Mercurial > piecrust2
view piecrust/admin/views/__init__.py @ 989:8adc27285d93
bake: Big pass on bake performance.
- Reduce the amount of data passed between processes.
- Make inter-process data simple objects to make it easier to test with
alternatives to pickle.
- Make sources have the basic requirement to be able to find a content item
from an item spec (path).
- Make Hoedown the default Markdown formatter.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 19 Nov 2017 14:29:17 -0800 |
parents | b1a00c2c0c7f |
children |
line wrap: on
line source
from flask import current_app, render_template, request from flask.views import View from .menu import get_menu_context class FoodTruckView(View): template_name = 'index.html' requires_menu = True def render_template(self, context): if self.requires_menu: context = with_menu_context() return render_template(self.template_name, **context) def get_context(self): return None def dispatch_request(self): ctx = self.get_context() return render_template(ctx) def with_menu_context(context=None): if context is None: context = {} context['menu'] = get_menu_context() return context