#!/usr/bin/python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- from decorators import WSGITemplate # decoratore ( singleton ) wsgitmpl = WSGITemplate() # # esempio minimo di controller WSGI # @wsgitmpl.template( 'template1.tmpl' ) def application( environ, start_response ): from pprint import pformat html = environ['template']( context=dict( v1=1, v2='pippo') ) start_response( '200 OK', [('content-type', 'text/html; charset=utf-8')] ) return [ html, pformat( environ, width=132 ).replace('\n','
\n') ] # TODO: pformat..... ---> trasformarlo in un decoratore