Hello,

i'm a newbie to sqlobject, and was trying to follow the doc.

i tried the following:

from sqlobject import *

uri = "postgres://user:[EMAIL PROTECTED]:5432/dbname"
conn = connectionForURI(uri)
sqlhub.processConnection = conn
conn.query("SELECT 1")


and got the following error:

Traceback (most recent call last):
  File "test_sqlobject.py", line 7, in ?
    conn.query("SELECT 1")
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 307, in query return self._runWithConnection(self._query, s)
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 219, in _runWithConnection conn = self.getConnection()
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 230, in getConnection conn = self.makeConnection()
  File
"/usr/lib/python2.4/site-packages/sqlobject/postgres/pgconnection.py",
line 110, in makeConnection conn = self.module.connect(**self.dsn_dict)
TypeError: an integer is required


i'm using psycopg2, and applying the attached patch solved it. it seems
the port must be an integer.


regards

lekma
--- sqlobject/postgres/pgconnection.py	2006-09-25 19:15:37.000000000 +0200
+++ sqlobject/postgres/pgconnection.py.new	2006-10-21 11:14:35.000000000 +0200
@@ -45,7 +45,7 @@
             if usePygresql:
                 dsn_dict["host"] = "%s:%d" % (host, port)
             else:
-                dsn_dict["port"] = str(port)
+                dsn_dict["port"] = int(port)
         if db:
             dsn_dict["database"] = db
         if user:
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to