Rodion
rodion at infobot.pl
Sun Oct 7 12:50:12 EDT 2007
Hello. Sorry for my poor english. Here is my mod_python code. This is a simple URL shorter: from mod_python import apache, util import psycopg2 as psycopg def handler(req): req.content_type = "text/plain" url_id = req.args connection = psycopg.connect("dbname=my_db") cursor = connection.cursor() cursor.execute("""SELECT myurl FROM urls WHERE myid=%s""",(url_id)) original_url = cursor.fetchone()[0] connection.close() util.redirect(req,original_url) req.status = apache.DONE return apache.DONE This programme connects database everytime, but I want(need) force him to connect it continously This script connects database everytime (psycopg.connect("dbname=my_db") , but I nedd force to stay conneceted with it continously. It is possible to make that in mod_python ? I have mod_python 3.2.10 Thanks in advance. rdn
|