[Product-Developers] Re: Traversing from a z3c.form action handler

Martin Aspeli optilude+lists at gmail.com
Sun Feb 14 10:07:50 UTC 2010


Cristopher Ewing wrote:
> I'm trying to work out a way to have the action in a z3c.form based form
> send the user to the built-in plone content_status_history form, similar
> to how the 'Change State' action on folder_contents works.
>
> For some reason I can't seem to find any examples of making this work.
> Can someone help me figure out what the right way is to accomplish this
> task? I need to use the form action handler to set the 'paths' parameter
> on the request, so that request.get('paths') will return the paths of
> the objects I've selected in my form. I can do that, but once it's done,
> how to I traverse on to the content_status_history form? That part has
> me stumped.

Did you try self.request.response.redirect(self.context.absolute_url() + 
'/content_status_history') ?

> restrictedTraverse will get me the FSControllerFormTemplate object,
> which is nice enough, but calling that just returns the html of the form
> without actually publishing it.

Yes, that's how restrictedTraverse() works. You could just return this 
HTML, but the URL would be wrong.

> It looks like perhaps something in zope.traversing might help, but
> nothing appears to implement the ITraversable interface from that package.
>
> Am I just on the wrong track here?

Any reason you don't just use a redirect?

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book





More information about the Product-Developers mailing list