3 Dec 16:56
problem with port setting for psycopg 1.1.21
Robert Forkel <xrotwang <at> googlemail.com>
2006-12-03 15:56:35 GMT
2006-12-03 15:56:35 GMT
hi,
just installed SQLObject-0.7.2b1-py2.4 on Ubuntu Dapper. PostgreSQL
8.1 listens on port 5433 by default, and psycopg 1.1.21 is installed.
Unfortunately, psycopg's connect function expects the port as str and
not as int:
>>> c.makeConnection()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/postgres/pgconnection.py",
line 110, in makeConnection
conn = self.module.connect(**self.dsn_dict)
TypeError: argument 4 must be string, not int
The following patch
root <at> rostrum:/etc/postgresql# diff -Naur
/usr/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/postgres/old_pgconnection.py
/usr/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/postgres/pgconnection.py
--- /usr/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/postgres/old_pgconnection.py
2006-12-03 16:51:12.000000000 +0100
+++ /usr/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/postgres/pgconnection.py
2006-12-03 16:28:16.000000000 +0100
@@ -107,6 +107,8 @@
if self.use_dsn:
conn = self.module.connect(self.dsn)
else:
+ if 'port' in self.dsn_dict:
+ self.dsn_dict['port'] = str(self.dsn_dict['port'])
conn = self.module.connect(**self.dsn_dict)
(Continue reading)



RSS Feed