[Grok-dev] Re: grok.View: Self-submitting forms, redirect, and before()

Martijn Faassen faassen at startifact.com
Fri Jan 12 10:29:35 EST 2007


Philipp von Weitershausen wrote:
> Suresh V wrote:
>> Christian Theune wrote:
>>>>
>>>>       def __call__(self):
>>>> -        self.before()
>>>> +        self.update()
>>>> +        if self.request.response.getStatus() in (302, 303):
>>
>> Could the above be better dealt with as an exception? Who will be 
>> setting this status?
> 
> You would be setting the status indirectly by 
> response.redirect('some-other-place') within self.update(). You can also 
> raise zope.publisher.interfaces.Redirect, but that needs no special 
> handling as the exception will propagate all the way to the publisher 
> anyway.

Actually we got the .redirect() method in Grok so no 
self.request.response.redirect() stuff necessary, just use 
self.redirect() in your view code which talks to the response for you.

Regards,

Martijn



More information about the Grok-dev mailing list