[Repoze-dev] bfg redirects

2009-06-27 Thread Iain Duncan
Hi folks, might be thinking about this all wrong, question re bgf

In the case of a post updating a model from a form, and the update is
done, I want to redirect to my 'view' view so as to prevent multiple
submissions. In the docs I can see how to do a redirect with a specied
url, but it seems like one of the advantages of the zcml config with
interfaces is that it can work with many models and actions ( update,
request for form etc ) without specifying the exact url.

So, the question is, what is the right way to kick the whole shebang
back to square one so that it matches for a view view after update?

Anyone have bfg example code of the form generation, validation, and
submission process? If not, this would be great to have for the docs.
Perhaps I can bungle through some examples that would be worth using if
I can get help cleaning them up for proper repoze/zope style when done.

Thanks
Iain

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg redirects

2009-06-27 Thread Chris McDonough
I think what your first question boils down to is how to I make a view 
redirect 
to itself.  The answer is usually:

from repoze.bfg.url import model_url
url = model_url(context, request, request.view_name)

As far as examples about form handling, the sample apps at 
http://docs.repoze.org/bfg/#sample-applications do a good deal of this.  None 
of 
these have any form *generation* in them (mostly because the authors aren't 
really form generation people).

- C

On 6/27/09 3:46 PM, Iain Duncan wrote:
 Hi folks, might be thinking about this all wrong, question re bgf

 In the case of a post updating a model from a form, and the update is
 done, I want to redirect to my 'view' view so as to prevent multiple
 submissions. In the docs I can see how to do a redirect with a specied
 url, but it seems like one of the advantages of the zcml config with
 interfaces is that it can work with many models and actions ( update,
 request for form etc ) without specifying the exact url.

 So, the question is, what is the right way to kick the whole shebang
 back to square one so that it matches for a view view after update?

 Anyone have bfg example code of the form generation, validation, and
 submission process? If not, this would be great to have for the docs.
 Perhaps I can bungle through some examples that would be worth using if
 I can get help cleaning them up for proper repoze/zope style when done.

 Thanks
 Iain

 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev