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

[EMAIL PROTECTED]:/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)
         except self.module.OperationalError, e:
             raise self.module.OperationalError("%s; used connection
string %r" % (e, self.dsn))

solved the problem for me, but i don't know - and cannot test -
whether this modification is compatible with other postgres adapters.
regards,
robert

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to