[Grok-dev] zope.app.wsgi adapters not registered by default

Christian Klinger cklinger at novareto.de
Wed May 11 07:55:50 EDT 2011

Hi Jeroen,

i guess you have to do something like this:
But i am not sure if it works...

   return tempfile.read()


> I'm upgrading a grok1.1 project to 1.4, and I came across this problem:
> I have some views that allow XML export of some objects. The view's render
> method returns an on-the-fly generated tempfile.TemporaryFile object. That
> used to work before, but not after upgrading to 1.4: I got a rather obscure
> 'TypeError: The result should be None, a string, or adaptable to IResult.'
> error.
> After some searching I found that zope.app.wsgi does define adapters for
> this, however, they don't seem to be registered by default. Adding
> 'zope.app.wsgi' to install_requires in setup.py solved the issue.
> Was this deliberate, or an oversight?
> If it is deliberate, there should be some mention of it in the docs.
> I tried with a clean 1.4 project, and had the same problem:
> create a new project and add
> from tempfile import TemporaryFile
> class Download(grok.View):
>      def render(self):
>          tempfile = TemporaryFile()
>          tempfile.write('testing')
>          return tempfile
> browsing to '/test/download' will give you the error (provided the app was
> added as 'test' of course).

More information about the Grok-dev mailing list