On Fri, Oct 23, 2009 at 1:58 PM, Thomas G. Willis <[email protected]> wrote:
>
> I would think formencode/htmlfill allows for this.
>
> If you need to validate the entire form, use a chained validator(or
> several), In your validator you can make your error message say
> whatever you want.

This is generally true, but sometimes you need to flag an error based
on information outside the form data, or not known until a particular
point in the action.  This is generally related to other data in the
database or in the session.

You can pass it to the validator via the 'state' argument, but there
are three problems with that:
    - 'state' is incompatible with @validate because the state is not
known when the decorator is called.
    - Checking external conditions can make the validators ugly and
non-portable.
    - 'state' is not well thought through.  The docs give the
impression that you can pass anything, but I think parts of FormEncode
assume it's a dict and add keys if so?

If you don't use 'state', your other choice is to check it manually in
the action.

-- 
Mike Orr <[email protected]>

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