I’ve been using a simple grok and Plone 4.1.4. So far I tried known good configuration for version 1.2.0 and 1.1.1 taken from here five.grok
I attempt to use grok.View with redirects, and whenever redirect code (self.redirect(‘url’)) is run, the following TypeError is raised:
TypeError: redirect() got an unexpected keyword argument 'trusted'
> /home/alex/projects/eggs/grokcore.view-1.13.5-py2.6.egg/grokcore/view/components.py(50)redirect()
-> url, status=status, trusted=trusted)
I found this discussion that deals with similar problem but no real solution. gmane
It’s really easy to reproduce the error, just have an update method in grok.View-derived class.
from five import grok
from Products.CMFCore.interfaces import ISiteRoot
class RedirectTest(grok.View):
grok.context(ISiteRoot)
grok.require('zope2.View')
grok.name('testredirect')
def update(self):
self.redirect(self.url(''))
def render(self):
self.redirect(self.url(''))
To use Grok on the Zope2 platform (used by Plone), you need to install the correct version of the
five.grokpackage.Grok is developed against the Zope Toolkit, and the publisher package in the ZTK has a slightly different API than what the Zope2 publisher offers.
five.grokbridges that difference. But you need to have the right version to make the correct match.For Plone 4.1 (Zope 2.13), make sure you use
five.grokversion 1.3.1 or newer:If you were to upgrade to Plone 4.2, the right version pin is included in the included versions.cfg file.