On Wed, Jun 24, 2009 at 11:08 AM, afrotypa <ovuaia...@gmail.com> wrote:
> > @restrict('POST') > @validate(schema=TestSchema(), form='edit', post_only=False, > on_get=True) > def save(self, id=None): > > I'm not following your full question, but right-off, I see a contradiction up there: If you restrict that action to only POST, then give on_get=True to validate, you'll never do a GET on save... maybe this is what you want? As you might expect, you can use @validate to already discriminate by HTTP method (post_only). At best, this is redundant. At worst, it might not be behaving as you had hoped. As far as your actual question goes, it seems like you want to change the displayed form as a result of how/whether the form was posted. A little weird, but sure, it's possible, if you go low-enough level. You may not be able to use stock @validate for that; you may have to write the logic yourself; you can still use htmlfill and TestSchema and so on, but the decision tree will have to be up to you so you can mess with the form while you process it. If you look at the code for @validate, you might be able to rip some of that off. Also, I don't think that FormEncode will mess with a form's option tags (other than to set which one is "selected"). Remember that the form itself is just text/string... Formencode eats the POST and modifies the string/template of 'edit' if there are errors. It doesn't generate the form, or otherwise see it as any kind of higher level structure... so it can't make new option tags for you. YOU could change the string before you send it into htmlfill, of course. The request parameters should be available in any case; it's still a request, even if @validate has chewed on it. Try running your request through a debugger, or throwing in an exception and poking around in the live error message thrown. You should still see params. I hope this helps; perhaps because I don't really understand your question, I am not giving comprehensible answer(s). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---