#!/usr/bin/python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- import template as tmpl from functools import partial def template( filename=None ): def real_decorator( wsgi_application ): def wrapper( environ, start_response ): environ[ 'template' ] = partial( tmpl.render, filename=filename ) return wsgi_application( environ, start_response ) return wrapper return real_decorator