On Jun 29, 12:18 pm, afrotypa <ovuaia...@gmail.com> wrote:
> I ran through the scenario again and did not see a 2nd http get to
> 'edit' upon validation failure. I can verify that 'edit' was indeed
> called though.

See lines 160-161 in pylons/decorators/__init__.py:

            request.environ['pylons.routes_dict']['action'] = form
            response = self._dispatch_call()

This replaces the original action returned by Routes, with the one
specified in the ``form`` argument.  It then calls
pylons.controllers.core.WSGIController._dispatch_call() [inherited
from your base controller], which calls the other action as Pylons
normally would.  All without another HTTP request.

If you do write alternate code to redisplay the form, you'd generate
the form into a variable (or render the page template if that's how
you'd normally do it), create a dict with the proper fill values
(based on request.params; probably not on self.form_result because the
validation failed), and then call htmlfill and return the result.

I also wonder if Javascript might be appropriate since you're
modifying one form control based on another.  This does mean the form
won't function properly if Javascript is disabled, but that may be
acceptable in the circumstance.  Then the form display would only have
to pre-set the base control, and let the Javascript set the derived
control.

--Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to