[LDTP-Dev] [Bug 606224] New: Exceptions do not return unicode data
LDTP (bugzilla.gnome.org)
bugzilla at gnome.org
Wed Jan 6 08:51:42 PST 2010
https://bugzilla.gnome.org/show_bug.cgi?id=606224
LDTP | pyldtp | unspecified
Summary: Exceptions do not return unicode data
Classification: Other
Product: LDTP
Version: unspecified
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: pyldtp
AssignedTo: ldtp-maint at gnome.bugs
ReportedBy: jtatum at gmail.com
QAContact: ldtp-dev at lists.freedesktop.org
GNOME target: ---
GNOME version: ---
I was having a problem passing a unicode string to LdtpExecutionError:
import ldtp
try:
raise ldtp.LdtpExecutionError(u"testraise\u221a")
except Exception, e:
print unicode(e)
The exceptions in LDTP seem to be copied from examples in the Python
documentation for overriding exceptions. Resultantly, they store the message in
a variable called value rather than in the args variable like the base class.
This wouldn't be a problem except that the base class has its own __unicode__
method which depends on the args variable, so calling unicode() on an LDTP
exception returns a null string.
Changing exceptions to just use the Exception class as-is resolves this issue.
The attached patch also makes LDTP exceptions inherit from ldtp.Error so all
LDTP exceptions can be caught by catching ldtp.Error. I think this was the
original design philosophy but it wasn't implemented.
There were quite a few places where an exception handler used
LdtpExecutionError.value - these are updated in the 0002 patch.
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are watching the assignee of the bug.
More information about the LDTP-dev
mailing list