#!/usr/bin/python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- from decorators import WSGIMySQL # decoratore ( singleton ) wsgisql = WSGIMySQL() # # esempio minimo di controller WSGI # @wsgisql.db( 'mywiki', 'shoot' ) def application( environ, start_response ): cur = environ['mysql.mywiki.cur'] # # esecuzione query # cur.execute( 'SHOW tables;' ) # # recupero record e generazione html # start_response( '200 OK', [('content-type', 'text/html; charset=utf-8')] ) yield "