Skip to content

Commit 4e6bf80

Browse files
committed
Better Py2/3 support
1 parent a324c1f commit 4e6bf80

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

jsonschema/exceptions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def __init__(self, type, instance, schema):
9999
self.schema = schema
100100

101101
def __str__(self):
102-
return self.__unicode__()
102+
return unicode(self).encode("utf-8")
103103

104104
def __unicode__(self):
105105
pschema = pprint.pformat(self.schema, width=72)
106106
pinstance = pprint.pformat(self.instance, width=72)
107107
return textwrap.dedent("""
108-
Uknown Type: %s, in schema:
108+
Unknown Type: %r, in schema:
109109
%s
110110
111111
On instance:
@@ -115,6 +115,8 @@ def __unicode__(self):
115115
_utils.indent(pschema),
116116
_utils.indent(pinstance))
117117

118+
if PY3:
119+
__str__ = __unicode__
118120

119121

120122

0 commit comments

Comments
 (0)