|
- #!/usr/bin/python
- # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
-
- from decorators import WSGISimpleAuth, WSGITemplate # decoratore ( singleton )
-
- auth = WSGISimpleAuth()
- wsgitmpl = WSGITemplate()
-
- #
- # esempio minimo di controller WSGI
- #
- @auth.require()
- @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, '<br><br><hr><br>', '<pre>', pformat( environ, width=132 ), '</pre>' ]
|