From: Mike Bayer Date: Sun, 22 Jan 2006 23:18:22 +0000 (+0000) Subject: postgres checks for string/int port ID, converts to int for pg2 and string for pg1 X-Git-Tag: rel_0_1_0~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841fc3b72fc4d11967aec22efd5b54141fcc3ae4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git postgres checks for string/int port ID, converts to int for pg2 and string for pg1 --- diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index da89541161..3a29186842 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -126,6 +126,12 @@ class PGSQLEngine(ansisql.ANSISQLEngine): except: self.version = 1 self.opts = opts or {} + if self.opts.has_key('port'): + if self.version == 2: + self.opts['port'] = int(self.opts['port']) + else: + self.opts['port'] = str(self.opts['port']) + ansisql.ANSISQLEngine.__init__(self, **params) def connect_args(self): diff --git a/test/testbase.py b/test/testbase.py index 825d540fa4..e6e2e8ef57 100644 --- a/test/testbase.py +++ b/test/testbase.py @@ -29,7 +29,8 @@ def parse_argv(): elif DBTYPE == 'sqlite_file': db = engine.create_engine('sqlite://filename=querytest.db', echo=echo, default_ordering=True) elif DBTYPE == 'postgres': - db = engine.create_engine('postgres://database=test&host=127.0.0.1&user=scott&password=tiger', echo=echo, default_ordering=True) + db = engine.create_engine('postgres://database=test&port=5432&host=127.0.0.1&user=scott&password=tiger', + echo=echo, default_ordering=True) elif DBTYPE == 'mysql': db = engine.create_engine('mysql://db=test&host=127.0.0.1&user=scott&passwd=tiger', echo=echo, default_ordering=True) elif DBTYPE == 'oracle':