Re: Getting the message key?

Felix Schwarz <felix.schwarz-S0/[email protected]> Wed, 26 Mar 2008 18:55:01 +0100
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Andreas Klostermann wrote:
> In the Tutorial, there is a clear way to do this: 

Which tutorial do you refer to?

> Create different validators with different Messages for each invalid case and 
 > chain them together.
> 
> If you are using turbogears you will want to modify the genshi template
> to differentiate the cases. 

How can I differentiate the cases without looking at the error message? 
Especially if you think of NestedVariables etc. If you use ForEach, you get 
only one state and one Invalid exception but I need the error cause for 
every single validation failure.

> The Invalid Exception does contain a lot of
> information beyond the error message. For example there is a variable
> called "state" which is used to pass on any kind of information you
> want. That might be bad API design, but at least it works. See the docs
> for more information.

I'm currently in a project where bad api design is a no-go - this 
architecture will (hopefully) last for several (>3-5) years.

fs

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss
smime.p7s (application/x-pkcs7-signature, 3.2 KB) - not displayed