Michel Pelletier wrote:
> 
> Paul Winkler wrote:
(snip)
> > Looking through various Zope docs, I thought RESPONSE.redirect might
> > work, but  RESPONSE is not mentioned anywhere in Boring.py. Boring
> > only uses REQUEST.
> 
> So pass it RESPONSE:
> 
> def manage_addMyProduct(self, blah, blah, REQUEST=None, RESPONSE=None):
>   ...
> 
> The publisher will automaticaly pass you RESPONSE if you ask for it as a
> method argument.  Now use RESPONSE.redirect.

Aha, thanks. I didn't know that about the publisher.

Now I'm afraid I'm too stupid to see how to use RESPONSE.redirect
after reading the description in the Zope Book API appendix.

My method now looks like this:

def manage_addMyProduct(self, id, title='', REQUEST=None,
RESPONSE=None):
    """Add a MyProduct instance to the folder."""
    self._setObject(id, MyProduct(id, title))
    if REQUEST is not None:
        whereto= REQUEST['URL3']
        return RESPONSE.redirect(whereto, 0)


That just prints the URL as a string.
OK, so maybe I'm not supposed to use the return value?
So I try it like this:


def manage_addMyProduct(self, id, title='', REQUEST=None,
RESPONSE=None):
    """Add a MyProduct instance to the folder."""
    self._setObject(id, MyProduct(id, title))
    if REQUEST is not None:
        whereto= REQUEST['URL3']
        RESPONSE.redirect(whereto, 0)


Now when I submit the form, I can wait for a result forever and not
get anything.

How am I *really* supposed to do it?




-- 
.................    paul winkler    ..................
slinkP arts:   music, sound, illustration, design, etc.
           web page:  http://www.slinkp.com
      A member of ARMS:   http://www.reacharms.com



_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to