On Sep 27, 3:48 pm, Mike Orr <[email protected]> wrote:
> >   �...@validate(movie_form, error_handler=index)
modified to:

@validate(form=movie_form, error_handler=index)

as listed on the docs - I missed the form=, however, even with that,
it doesn't change it.

http://turbogears.org/2.0/docs/main/ToscaWidgets/forms.html lists it
as I had done.  This was originally TG2 code which did work, and the
original:

 @validate(MovieForm(), error_handler=save)

also worked in TG2.

> Is this a current ToscaWidgets/Pylons tutorial?  There have been
> problems with obsolete tutorials being left around before.  The
> @validate args seem to be wrong, but I've only used ToscaWidgets once
> a year ago.
>
> There is one place in validate where it recursively dispatches.
> However, I'm not sure it's related to this problem because validate
> does not appear in the traceback.  Lines 155-161 in
> pylons/decorators/__init__.py) are:
>
>             # If there's no form supplied, just continue with the current
>             # function call.
>             if not form:
>                 return func(self, *args, **kwargs)
>
>             request.environ['pylons.routes_dict']['action'] = form
>             response = self._dispatch_call()
>
> This says if there's no 'form' argument, call the wrapped function
> (the original action) and return.  Otherwise change the action to the
> 'form' arg and dispatch to it.  In your case, I would expect 'form' to
> be None.  But maybe it's a function somehow?
>
> You can introspect the function object in the interactive traceback.
> If we know what the function is, that may help explain how it got
> there.  Try ``vars(action)`` and ``action.__name__``, and
> ``action.func_name``.

>>> vars(action)
{}
>>> action.__name__
'index'
>>> action.func_name
'index'

Which is what I expected since there is an error on the form and it
should be handed back to the error handler.  If the validation doesn't
encounter an error, it does display the results.  Leaving description
blank comes up with the exception.


>
> You can also insert "raise RuntimeError" just before the dispatch call
> to verify whether this code path is being executed.

Thanks for the pointer.  I'll see if I can dig further into it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to