#!/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 "

elenco tabelle presenti nel db mywiki

" for record in cur.fetchall(): yield str( record ) + "
" # # recupero secondo cursore # cur2 = environ['mysql.shoot.cur'] # # esecuzione query # cur2.execute( 'SHOW tables;' ) # # recupero record e generazione html # yield "

elenco tabelle presenti nel db shoot

" for record in cur2.fetchall(): yield str( record ) + "
"