Fix to_unicode with lazyT
* Fix to_unicode with lazyT
see https://groups.google.com/forum/#!topic/web2py/uR8y9OqdfME
* Fixed problem with stuff that returns None for missing attrs
@@ -154,7 +154,7 @@ def with_metaclass(meta, *bases):
def to_unicode(obj, charset='utf-8', errors='strict'):
if obj is None:
return None
- if not isinstance(obj, bytes):
+ if not hasattr(obj, 'decode') or not callable(obj.decode):
return text_type(obj)
return obj.decode(charset, errors)
