25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
495 B

  1. #!/usr/bin/python
  2. # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
  3. import deco # decoratori
  4. import traceback
  5. #
  6. # esempio minimo di controller WSGI
  7. #
  8. @deco.template( 'template1.tmpl' )
  9. def application( environ, start_response ):
  10. try:
  11. html = environ['template']( context=dict( v1=1, v2='pippo') )
  12. except:
  13. html = "<pre>" + traceback.format_exc() + "</pre>"
  14. start_response( '200 OK', [('content-type', 'text/html; charset=utf-8')] )
  15. return [ html ]