Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo in README.md #65

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The following shows how to use this for a custom class that's stored as
a JSON string for example:

```python

import sys
from json import JSONEncoder, JSONDecoder
from rejson import Client

Expand Down Expand Up @@ -128,11 +128,13 @@ a JSON string for example:
return str(obj)
return json.JSONEncoder.encode(self, obj)

class TestDecoder(JSONDecoder):
class CustomDecoder(JSONDecoder):
"A custom decoder for the custom class"
def decode(self, obj):
d = json.JSONDecoder.decode(self, obj)
if isinstance(d, basestring) and d.startswith('CustomClass:'):

str_type = basestring if sys.version_info.major == 2 else str
if isinstance(d, str_type) and d.startswith('CustomClass:'):
return CustomClass(d)
return d

Expand Down