[Zope-DB] Fix for Zope 2.7.0, ZMySQLDA 2.0.8 and MySQL-python.exe-0.9.2.win32-py2.3.exe

Chris Withers chris at simplistix.co.uk
Sat Apr 3 15:38:13 EST 2004


(bcc'ed to people who appeared to have been having this problem, apologies if 
you've already fixed this)

Hi All,

Right, firstup, the "correct" way to fix this would appear to be to move to 
mysql-python 0.9.3b3 and ZMySQLDA 2.0.9b2.

Sadly, no Windows binary is (yet?) available for mysql-python 0.9.3b3, and some 
people may be reluctant to use tests releases. So people end up getting 
AttributeError's on server_capabilities ;-)

The attached patch to ZMySQLDA's db.py appears to fix this for me.
Please give it a go and let me know how you fare...

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk
-------------- next part --------------
--- db.py.old	2004-04-03 18:08:15.296875000 +0100
+++ db.py	2004-04-03 18:13:38.437500000 +0100
@@ -104,6 +104,7 @@
 import string, sys
 from string import strip, split, find, upper, rfind
 from time import time
+import types
 
 hosed_connection = (
     CR.SERVER_GONE_ERROR,
@@ -153,9 +154,14 @@
     try: return int(s)
     except: return long(s)
 
+if hasattr(types, "ObjectType"):
+    class ConnectWrapper(_mysql.connection): pass
+else:
+    ConnectWrapper=_mysql.connect
+    
 class DB(TM):
 
-    Database_Connection=_mysql.connect
+    Database_Connection = ConnectWrapper
     Database_Error=_mysql.Error
 
     defs={


More information about the Zope-DB mailing list