@@ -774,9 +774,8 @@ class ResponseBody(object):
774
774
775
775
"""The body of the HTTP response (the response entity)."""
776
776
777
- if six .PY3 :
778
- unicode_err = ('Page handlers MUST return bytes. Use tools.encode '
779
- 'if you wish to return unicode.' )
777
+ unicode_err = ('Page handlers MUST return bytes. Use tools.encode '
778
+ 'if you wish to return unicode.' )
780
779
781
780
def __get__ (self , obj , objclass = None ):
782
781
if obj is None :
@@ -787,7 +786,7 @@ def __get__(self, obj, objclass=None):
787
786
788
787
def __set__ (self , obj , value ):
789
788
# Convert the given value to an iterable object.
790
- if six . PY3 and isinstance (value , str ):
789
+ if isinstance (value , six . text_type ):
791
790
raise ValueError (self .unicode_err )
792
791
793
792
if isinstance (value , text_or_bytes ):
@@ -799,10 +798,10 @@ def __set__(self, obj, value):
799
798
else :
800
799
# [''] doesn't evaluate to False, so replace it with [].
801
800
value = []
802
- elif six . PY3 and isinstance (value , list ):
801
+ elif isinstance (value , list ):
803
802
# every item in a list must be bytes...
804
803
for i , item in enumerate (value ):
805
- if isinstance (item , str ):
804
+ if isinstance (item , six . text_type ):
806
805
raise ValueError (self .unicode_err )
807
806
# Don't use isinstance here; io.IOBase which has an ABC takes
808
807
# 1000 times as long as, say, isinstance(value, str)
0 commit comments