[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).
--- 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)