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

Jeroen Michiel jmichiel at yahoo.com
Wed May 11 07:48:23 EDT 2011


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).
-- 
View this message in context: http://old.nabble.com/zope.app.wsgi-adapters-not-registered-by-default-tp31593485p31593485.html
Sent from the Grok mailing list archive at Nabble.com.



More information about the Grok-dev mailing list