Re: PyGreSQL bug
От | Bruce Momjian |
---|---|
Тема | Re: PyGreSQL bug |
Дата | |
Msg-id | 200204180212.g3I2CBe22595@candle.pha.pa.us обсуждение исходный текст |
Список | pgsql-hackers |
No one has replied, so I worked up a patch that I will apply in a few days. Let me know if you don't like it. --------------------------------------------------------------------------- Andrew Johnson wrote: > Not sure if you're the right person to be talking to here, but the recent > CVS pacthes to the module belong to you, so here goes. > > pgdb.connect() seems to be broken on Python 2.0.1 (which ships with > Slackware 8), and perhaps on other Pythons, haven't checked. Something in > the _pg.connect() call isn't working. I think the problem stems from the > fact that 'host' is a named parameter of both _pg.connect and pgdb.connect, > and so Python treats it as a variable assignment, not a named parameter. > > In any case, rewriting the call without named parameters solved the problem. > > Instead of: > > cnx = _pg.connect(host = dbhost, dbname = dbbase, port = dbport, > opt = dbopt, tty = dbtty, > user = dbuser, passwd = dbpassw > > use: > > cnx = _pg.connect(dbbase, dbhost, dbport, dbopt, > dbtty, dbuser, dbpasswd) > > -- > Andrew Johnson (ajohnson@lynn.ci-n.com) > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 Index: src/interfaces/python/pgdb.py =================================================================== RCS file: /cvsroot/pgsql/src/interfaces/python/pgdb.py,v retrieving revision 1.10 diff -c -r1.10 pgdb.py *** src/interfaces/python/pgdb.py 19 Mar 2002 02:47:57 -0000 1.10 --- src/interfaces/python/pgdb.py 18 Apr 2002 02:10:20 -0000 *************** *** 337,343 **** ### module interface # connects to a database ! def connect(dsn = None, user = None, password = None, host = None, database = None): # first get params from DSN dbport = -1 dbhost = "" --- 337,343 ---- ### module interface # connects to a database ! def connect(dsn = None, user = None, password = None, xhost = None, database = None): # first get params from DSN dbport = -1 dbhost = "" *************** *** 364,372 **** dbpasswd = password if database != None: dbbase = database ! if host != None: try: ! params = string.split(host, ":") dbhost = params[0] dbport = int(params[1]) except: --- 364,372 ---- dbpasswd = password if database != None: dbbase = database ! if xhost != None: try: ! params = string.split(xhost, ":") dbhost = params[0] dbport = int(params[1]) except:
В списке pgsql-hackers по дате отправления: