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 XML renderer for snapshots (used when previewing with Enketo) #2035

Merged
merged 8 commits into from
Oct 23, 2018

Conversation

noliveleger
Copy link
Contributor

@jnm, I finally kept DEFAULT_RENDERER_CLASSES in settings.

I just removed rest_framework_xml.renderers.XMLRenderer and used an extended class of it.
This class now replaces AssetSnapShotRenderer where it was called. Even XFormRenderer is based on it.

Fixes #2029

@noliveleger noliveleger requested a review from jnm October 19, 2018 15:28
@jnm jnm changed the title 2029 snapshot xml renderer - fix Fix XML renderer for snapshots (used when previewing with Enketo) Oct 23, 2018
@@ -145,10 +145,11 @@ def _requests_response_to_django_response(requests_response):
django_response.write(requests_response.content)
return django_response


#@renderer_classes((JSONRenderer, XMLRenderer))
Copy link
Member

Choose a reason for hiding this comment

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

What's this for? Is it a TODO for the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it was! But I changed my mind since I pushed this commit and I will do it another way

def list(self, kpi_request, *args, **kwargs):
return self.retrieve(kpi_request, None, *args, **kwargs)

#@renderer_classes((JSONRenderer, XMLRenderer))
Copy link
Member

Choose a reason for hiding this comment

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

Same question as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer as above :-)

kpi/renderers.py Outdated
@@ -49,4 +59,4 @@ class XlsRenderer(renderers.BaseRenderer):
def render(self, data, media_type=None, renderer_context=None):
asset = renderer_context['view'].get_object()
return asset.to_xls_io(versioned=self.versioned,
kobo_specific_types=self.kobo_specific_types)
kobo_specific_types=self.kobo_specific_types)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@noliveleger noliveleger Oct 23, 2018

Choose a reason for hiding this comment

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

The problem is not my IDE, it's me. I know about the blank line at the end (and PyCharms too) but sometimes I forget.
I won't anymore.
screen shot 2018-10-23 at 10 30 04 am

@jnm jnm merged commit e0842b5 into master Oct 23, 2018
@jnm jnm deleted the 2029-snapshot-xml-renderer branch October 23, 2018 16:26
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.

2 participants