-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
pass json-compatible object to json_response #8085
Conversation
@@ -385,7 +385,7 @@ def import_report(request, domain): | |||
def report_source_json(request, domain, report_id): | |||
config = get_document_or_404(ReportConfiguration, domain, report_id) | |||
config._doc.pop('_rev', None) | |||
return json_response(config) | |||
return json_response(config._doc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like the right fix to me. Something inside config._doc is not actually json serializable somehow, and I think we need to figure out what that is. Anything that's json serializable can be deepcopy
d and it's essentially failing on deepcopy(config._doc)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(it's a lazy translation - which json_response
handles in the json encoder)
it does seem curious that a translation would end up in an jsonobject
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@czue How do you know it's a translation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think maybe i'm wrong actually. i thought i had seen that error before but looking closer it seems like i might just be misremembering.
looks similar to dimagi/jsonobject#115 |
Sort of. That jsonobject issue is about not being able to deepcopy doc.some_dict_property directly, which doesn't seem to be happening here. If you can reproduce this locally I can come help you debug. |
reproduction steps in the shell:
|
http://manage.dimagi.com/default.asp?180877
@dannyroberts