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

Raise RuntimeError when trying to encode coreapi objects #4790

merged 1 commit into from Jan 6, 2017


Copy link

@micgeronimo micgeronimo commented Jan 6, 2017

JSONEncoder.default didn't raise RuntimeError as intended because there is another "if" above which returns earlier.
Maybe it is better to put check for coreapi objects on top of default method?

raise RuntimeError(
'Cannot return a coreapi object from a JSON view. '
'You should be using a schema renderer instead for this view.'
elif hasattr(obj, '__getitem__'):
Copy link
Contributor Author

@micgeronimo micgeronimo Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "if" blocks coreapi check

@tomchristie tomchristie added the Bug label Jan 6, 2017
@tomchristie tomchristie added this to the 3.5.4 Release milestone Jan 6, 2017
Copy link

tomchristie commented Jan 6, 2017

Good catch, thanks!

@tomchristie tomchristie merged commit a5fcf10 into encode:master Jan 6, 2017
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants