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

pass json-compatible object to json_response #8085

Closed
wants to merge 1 commit into from

Conversation

nickpell
Copy link
Contributor

@nickpell nickpell commented Sep 1, 2015

@@ -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)
Copy link
Member

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 deepcopyd and it's essentially failing on deepcopy(config._doc).

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

@nickpell
Copy link
Contributor Author

nickpell commented Sep 2, 2015

looks similar to dimagi/jsonobject#115

@dannyroberts
Copy link
Member

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.

@nickpell
Copy link
Contributor Author

nickpell commented Sep 2, 2015

reproduction steps in the shell:

from corehq.apps.userreports.models import *
data_source_config = CustomDataSourceConfiguration.by_id('custom-airs-static-supervisory-indicators')
data_source_config.to_json()

@nickpell nickpell closed this Sep 2, 2015
@nickpell nickpell mentioned this pull request Sep 2, 2015
@proteusvacuum proteusvacuum deleted the show-custom-datasource branch June 28, 2016 22:04
@snopoke snopoke restored the show-custom-datasource branch March 19, 2017 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants