'HttpResponse' object has no attribute 'render'
rosscdh opened this issue · 5 comments
Hi there,
Firstly, GREAT app and exactly what I had in mind with wagtail! Thank you.
Just found a small "bug" with the build management command when a content object returns an HttpResponse object that has already rendered
bakery/views/base.py
self.get(self.request).render().content
throws
AttributeError: 'HttpResponse' object has no attribute 'render'
The "fix" on my side was to
resp = self.get(self.request)
if hasattr(resp, 'render'):
return resp.render().content
elif hasattr(resp, 'content'):
return resp.content
else:
raise Exception('Response has no content')
Which is a little ugly especially in the else case.. but I was just wanting to "make it work" on my side.
settings
BAKERY_MULTISITE = True
BAKERY_VIEWS = (
'wagtailbakery.views.AllPublishedPagesView',
)
BUILD_DIR = '/tmp/asset-manager-build/'
Hi @rosscdh thanks!
We ran also into the same issue, we will provide a fix on very short notice (and first pypi version).
Please feel free to report any other suggestions and/or issues.
Do you have an example site which now runs with this module, just curious :).
Cheers
Just ran into this issue again with HttpResponseRedirect
response objects.
Probably you use render_to_response
or render
shortcuts in your Wagtail page.
Will provide a fix for this!
Thanks.. Happy to do a PR or take a note :)
Master should now work fine!