dabo Commit
Revision 6120
Date: 2010-10-19 14:23:39 -0700 (Tue, 19 Oct 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6120

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

Log:
ustr(e) will try to decode with various encodings before bailing, whereas
unicode(e) will try to decode with ascii, which is guaranteed to fail when
the error message contains characters > 127.

Next we may want to consider enhancing ustr() to not bail if no encodings
work, but instead ignore the error(s) so the original error message can be 
raised instead. 


Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2010-10-19 18:46:48 UTC (rev 6119)
+++ trunk/dabo/db/dCursorMixin.py       2010-10-19 21:23:39 UTC (rev 6120)
@@ -374,7 +374,7 @@
                        try:
                                errMsg = ustr(e).decode(self.Encoding)
                        except UnicodeError:
-                               errMsg = unicode(e)
+                               errMsg = ustr(e)
                        dabo.log.error("Error fetching records: %s" % errMsg)
 
                if _records and not 
self.BackendObject._alreadyCorrectedFieldTypes:



_______________________________________________
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