eval(WsgiApplication)
gert
gert.cuykens at gmail.com
Fri May 1 20:56:24 EDT 2009
I would like to read the following from a text file
from json import loads
from gert.db import Db
def application(environ, response):
v = loads(environ['wsgi.input'].read(int(environ
['CONTENT_LENGTH'])).decode('utf-8'))
db = Db()
db.execute('UPDATE votes SET count=count+1 WHERE vid=?',(v
['vid'],))
db.execute('SELECT * FROM votes')
j = '{"rec":'+db.json()+',\n'
j+= ' "des":'+db.jdes()+'}'
j = j.encode('utf-8')
response('200 OK', [('Content-type', 'text/
javascript;charset=utf-8'), ('Content-Length', str(len(j)))])
return [j]
execute it, and wrap a new function name around it for example
def wrapper(environ, response):
exec(file)
return application(environ, response)
How do I do this in python3?
More information about the Python-list
mailing list