After all these hours, I found it: MySQLConnection uses two different default values for the port
specification.
def __init__(self, db, user, passwd='', host='localhost', port=None, **kw):
and
def connectionFromURI(cls, uri):
user, password, host, port, path, args = cls._parseURI(uri)
return cls(db=path.strip('/'), user=user or '', passwd=password or '',
host=host or 'localhost', port=port or 0, **args)
connectionFromURI works as the port is always an integer which seems to be
required by MySQL.
If I modify this line in my script (see my previous post)
connection = MySQLConnection(user='root', db='xamstest')
to
connection = MySQLConnection(user='root', db='xamstest', port=0)
I get at least a connection to the database.
Therefore I propose changing the default value of __init__ to be "0" and not
"None".
And now the changes outlined in my previous mail in order to support the conv keyword for MySQL do
indeed work as expected. See conv.patch. I hope that the need for the changes enclosed in the
attached patch files are explained well enough. If anything is unclear please ask.
fs
--- sqlobject/mysql/mysqlconnection.py 2007-01-10 18:25:04.000000000 +0100
+++ mysqlconnection.py 2007-01-10 15:19:28.000000000 +0100
@@ -8,7 +8,7 @@
dbName = 'mysql'
schemes = [dbName]
- def __init__(self, db, user, passwd='', host='localhost', port=0, **kw):
+ def __init__(self, db, user, passwd='', host='localhost', port=None, **kw):
global MySQLdb
if MySQLdb is None:
import MySQLdb
--- sqlobject/mysql/mysqlconnection.py 2007-01-10 18:30:00.000000000 +0100
+++ mysqlconnection.py 2007-01-10 18:29:50.000000000 +0100
@@ -20,7 +20,7 @@
self.password = passwd
self.kw = {}
for key in ("unix_socket", "named_pipe", "init_command",
- "read_default_file", "read_default_group", "conv"):
+ "read_default_file", "read_default_group"):
if key in kw:
self.kw[key] = col.popKey(kw, key)
for key in ("connect_time", "compress", "named_pipe", "use_unicode",
-------------------------------------------------------------------------
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