anyjson 0.3.2 now supports buffer objects, so pass them on

This commit is contained in:
Ask Solem 2012-06-21 16:24:01 +01:00
parent df7913860f
commit c6360288ec
1 changed files with 3 additions and 3 deletions

View File

@ -286,9 +286,9 @@ def register_json():
from anyjson import loads, dumps
def _loads(obj):
if isinstance(obj, buffer):
obj = str(obj)
return loads(bytes_to_str(obj))
if isinstance(obj, str):
obj = bytes_to_str(obj)
return loads(obj)
registry.register('json', dumps, _loads,
content_type='application/json',