Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
burivuh authored and jbenua committed Oct 9, 2019
1 parent 07254c0 commit 4257e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion snippets/pyaloha/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="0.1.2"
__version__="0.1.3"
8 changes: 4 additions & 4 deletions snippets/pyaloha/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ def custom_loads(dct):

class CustomEncoder(json.JSONEncoder):
def default(self, obj):
if not isinstance(obj, str) and isinstance(obj, bytes):
# in python 2.7 str is bytes; don't decode it
return obj.decode()

if hasattr(obj, '__dumpdict__'):
obj = obj.__dumpdict__()

if isinstance(obj, dict):
# process json unprocessable dict keys
return decode_keys_for_json(obj)

if not isinstance(obj, str) and isinstance(obj, bytes):
# in python 2.7 str is bytes; don't decode it
return obj.decode()

# Let the base class default method raise the TypeError
return super(CustomEncoder, self).default(obj)

Expand Down

0 comments on commit 4257e06

Please sign in to comment.