[Zope3-Users] Re: redirects in a formlib EditForm

Gary Poster gary at zope.com
Mon Feb 27 21:04:53 EST 2006


On Feb 27, 2006, at 8:39 PM, Joel Moxley wrote:
>
> Damn, I still can't get this working right after following all of the
> instructions here.  I can successfully stash the refering url in a
> hidden form, but it's not showing up in my request.

I can think of two possible things.

One is that you are maybe getting a form validation error and then  
pressing Apply, or that you are using a widget that redraws the screen.

Another is that we might have a bug that makes form variables be  
stomped on by header names. :-(

First try changing
>
>     def referer(self):
>         return self.request.getHeader('HTTP_REFERER')

to

def referer(self):
     return self.request.form.get('HTTP_REFERER') or  
self.request.getHeader('HTTP_REFERER')

Then if that doesn't work, try changing it to

def referer(self):
     return self.request.form.get('referrer') or  
self.request.getHeader('HTTP_REFERER')

and changing your template to have
>    <input type="hidden" name="referrer" value=""
>         tal:attributes="value view/referer" />

(Sadly, the spec made a spelling error with "referer". :-) )

> By the way, my svn update had a conflict at
> src/zope/interface/common/.  I deleted the old one and it worked fine,
> but I guess I'll note it here.

Yeah, they are rearranging things at PyCon.

Gary


More information about the Zope3-users mailing list