選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

22 行
620 B

  1. #!/usr/bin/python
  2. # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
  3. from decorators import WSGISimpleAuth, WSGITemplate # decoratore ( singleton )
  4. auth = WSGISimpleAuth()
  5. wsgitmpl = WSGITemplate()
  6. #
  7. # esempio minimo di controller WSGI
  8. #
  9. @auth.require()
  10. @wsgitmpl.template( 'template1.tmpl' )
  11. def application( environ, start_response ):
  12. from pprint import pformat
  13. html = environ['template']( context=dict( v1=1, v2='pippo') )
  14. start_response( '200 OK', [('content-type', 'text/html; charset=utf-8')] )
  15. return [ html, '<br><br><hr><br>', '<pre>', pformat( environ, width=132 ), '</pre>' ]