Re: [SQLObject] Connection URI and Windows Paths...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2004-05-26 15:54:18
|
Okay, I made this change (using os.path.sep) just for Firebird.=20 Generally /'s are supposed to be okay, and I'd rather stick with a=20 canonical form, so I don't want to change this for all databases (though=20 if it comes up for another database I might do it for all databases... I=20 guess the only one which might have a problem would be SQLite). Ian Sparks wrote: >>From scouring the source (is connectionForURI documented anywhere?) I d= iscover that the connectionForURI method takes an argument string somethi= ng like : >=20 > connectionForURI("<DB_TYPE>://<USERID>:<password>@<HOST>/<PATH>) >=20 > so for a Firebird connection : >=20 > connectionForURI("firebird://SYSDBA:masterkey@localhost/data/somewhere/= my_db.gdb") >=20 > but this seems broken on Windows if I want to connect to a DB on my D: = drive : >=20 > connectionForURI("firebird://SYSDBA:masterkey@localhost/D:/my_db.gdb") >=20 > I get some error about an "undefined service d/tcp.." from kinterbasdb = because its trying to open /D:/my_db.gdb and, naturally, gets confused >=20 > I believe that the following (naive) patch against dbconnection.py will= fix if inserted at line 95 : >=20 > if path.find(':') !=3D -1: > start,rest =3D path.split(':') > start =3D start.replace('\\','') > start =3D start.replace('/','') > path =3D start + ':' + rest >=20 > There is probably a better way but this fixes it for me. >=20 > Be good if something with the same effect could make it into 0.6 SVN. T= hank you. >=20 >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g= .=20 > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id149&alloc_id=8166&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss --=20 Ian Bicking / ia...@co... / http://blog.ianbicking.org |