[server] fix 'cnx' variable confusion in DBG_SQL exception case
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 10 Sep 2014 11:34:32 +0200
changeset 10076 3810332ef42c
parent 10073 c53062c49d53
child 10113 e1e8df594d58
[server] fix 'cnx' variable confusion in DBG_SQL exception case The rollback handling expects 'cnx' to be the cubicweb Connection, but the DBG_SQL block was replacing it with an sql connection, leading to lulz down the line. Also remove obsolete getattr (the sqlite wrapping is now done at the cnxset level, so cnx.cnxset.cnx should be the right thing already).
server/sources/native.py
--- a/server/sources/native.py	Sun Nov 30 21:24:36 2014 +0100
+++ b/server/sources/native.py	Wed Sep 10 11:34:32 2014 +0200
@@ -699,10 +699,7 @@
         """
         cursor = cnx.cnxset.cu
         if server.DEBUG & server.DBG_SQL:
-            cnx = cnx.cnxset.cnx
-            # getattr to get the actual connection if cnx is a CnxLoggingWrapper
-            # instance
-            print 'exec', query, args, getattr(cnx, '_cnx', cnx)
+            print 'exec', query, args, cnx.cnxset.cnx
         try:
             # str(query) to avoid error if it's a unicode string
             cursor.execute(str(query), args)