dabo Commit
Revision 5806
Date: 2010-05-08 07:28:17 -0700 (Sat, 08 May 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5806
Changed:
U trunk/dabo/db/dConnection.py
U trunk/dabo/db/dbMsSQL.py
Log:
Added code to handle newer versions of pymssql.py that require an additional
param to the __init__() method. Also cleaned up the apply() code in dConnection.
Diff:
Modified: trunk/dabo/db/dConnection.py
===================================================================
--- trunk/dabo/db/dConnection.py 2010-05-03 18:19:02 UTC (rev 5805)
+++ trunk/dabo/db/dConnection.py 2010-05-08 14:28:17 UTC (rev 5806)
@@ -58,10 +58,11 @@
superMixin = dCursorMixin
superCursor = cursorClass
def __init__(self, *args, **kwargs):
- if hasattr(dCursorMixin, "__init__"):
- apply(dCursorMixin.__init__,(self,) +
args, kwargs)
- if hasattr(cursorClass, "__init__"):
- apply(cursorClass.__init__,(self,) +
args, kwargs)
+ for cls in (dCursorMixin, cursorClass):
+ try:
+ apply(cls.__init__, (self, ) +
args, kwargs)
+ except AttributeError:
+ pass
bo = self.getBackendObject()
crs = bo.getCursor(DaboCursor)
Modified: trunk/dabo/db/dbMsSQL.py
===================================================================
--- trunk/dabo/db/dbMsSQL.py 2010-05-03 18:19:02 UTC (rev 5805)
+++ trunk/dabo/db/dbMsSQL.py 2010-05-08 14:28:17 UTC (rev 5806)
@@ -41,12 +41,16 @@
def getDictCursorClass(self):
"""Currently this is not working completely"""
import pymssql
- class conCursor(pymssql.pymssqlCursor):
+ class ConCursor(pymssql.pymssqlCursor):
+ def __init__(self, *args, **kwargs):
+ # pymssql requires an additional param to its
__init__() method
+ kwargs["as_dict"] = True
+ super(ConCursor, self).__init__(*args, **kwargs)
def _getconn(self):
return self.__source
# pymssql doesn't supply this optional dbapi attribute,
so create it here.
connection = property(_getconn, None, None)
- return conCursor
+ return ConCursor
def escQuote(self, val):
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]