Well,
  I'm trying implement this then in my code.py I have this code:
from model import setDB, unsetDB
def db_handler(handler):
  setDB()
  result=handler()
  unsetDB()
  return result
webapp = web.application(urls, globals())
webapp.add_processor(db_handler)
im my model.py I have this code:
db = web.database(dbn=DBN, host=HOST, db=DB, user=USER, pw=PWD)
def unsetDB():
  print '>>>>>>>>> in the unset <<<<<<<<<<<'
  db = None
  print str(db)
def setDB():
  print '>>>>>>>>> in th SET <<<<<<<<<<<'
  unsetDB()
  db = web.database(dbn=DBN, host=HOST, db=DB, user=USER, pw=PWD)
  print str(db)
but when I look in my system process monitor I still have a opened connection with database
any idea ?