File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
import functools
2
2
3
+ import six
4
+
3
5
from business_logic .exceptions import LogicException
4
6
5
7
@@ -57,6 +59,7 @@ def wrapper(*args, **kwargs):
57
59
return wrapper
58
60
59
61
62
+ @six .python_2_unicode_compatible
60
63
class ValidationResult (object ):
61
64
"""
62
65
Class for storing result of validation function.
@@ -94,4 +97,4 @@ def __repr__(self):
94
97
return u'<PermissionResult success={} error={}>' .format (self .success , self .error )
95
98
96
99
def __str__ (self ):
97
- return str (self .error ) if self .error else u''
100
+ return six . text_type (self .error ) if self .error else u''
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ def test_comparision(self):
53
53
# comparision with other types should raise false
54
54
self .assertFalse (success_result == 1 )
55
55
56
+ def test_unicode_is_handled_properly (self ):
57
+ unicode_text = u'Zażółć gęślą jaźń'
58
+ result = core .ValidationResult (success = False , error = exceptions .LogicException (unicode_text ))
59
+ self .assertEqual (u'{}' .format (result ), unicode_text )
60
+
56
61
57
62
class TestValidator (TestCase ):
58
63
You can’t perform that action at this time.
0 commit comments