dabo Commit
Revision 6382
Date: 2011-02-03 14:50:14 -0800 (Thu, 03 Feb 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6382

Changed:
U   trunk/dabo/db/dCursorMixin.py

Log:
Attempt to make less deceiving dbActivityLog entry for execute(), per
Jacek in ticket #1394.


Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2011-02-03 18:26:51 UTC (rev 6381)
+++ trunk/dabo/db/dCursorMixin.py       2011-02-03 22:50:14 UTC (rev 6382)
@@ -321,17 +321,27 @@
                                res = self.superCursor.execute(self, sql, 
params)
                                if not self.IsPrefCursor:
                                        try:
-                                               dabo.dbActivityLog.info("SQL: 
%s, PARAMS: %s" % (
+                                               
dabo.dbActivityLog.info("execute() SQL: %s, PARAMS: %s" % (
                                                                
sql.decode(self.Encoding).replace("\n", " "),
                                                                ', '.join("%s" 
% p for p in params)))
                                        except StandardError:
                                                # A problem with writing to the 
log, most likely due to encoding issues
-                                               dabo.dbActivityLog.info("FAILED 
SQL: %r" % sql)
+                                               try:
+                                                       
dabo.dbActivityLog.info("execute() SQL (failed to log PARAMS): %r" % sql)
+                                               except StandardError:
+                                                       
dabo.dbActivityLog.info("execute() (failed to log SQL and PARAMS)") 
                        else:
                                res = self.superCursor.execute(self, sql)
                                if not self.IsPrefCursor:
-                                       dabo.dbActivityLog.info("SQL: %s" % (
-                                                       
sql.decode(self.Encoding).replace("\n", " "),))
+                                       try:
+                                               
dabo.dbActivityLog.info("execute() SQL: %s" % (
+                                                               
sql.decode(self.Encoding).replace("\n", " "),))
+                                       except StandardError:
+                                               # A problem with writing to the 
log, most likely due to encoding issues
+                                               try:
+                                                       
dabo.dbActivityLog.info("execute() SQL: %r" % sql)
+                                               except StandardError:
+                                                       
dabo.dbActivityLog.info("execute() (failed to log SQL)")
                except Exception, e:
                        # There can be cases where errors are expected. In 
those cases, the
                        # calling routine will pass the class of the expected 
error, and will



_______________________________________________
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]

Reply via email to