Re: Partial validation results from an invalid input?
Chris Lambacher <[email protected]> Mon, 26 Dec 2011 17:41:35 -0500
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <CAAXXHgJTFeJg-=qit6z2nsA7=K9hfpagMJ6GvRLhxh3=O_xS0Q@mail.gmail.com> |
Hi Dan, There is no official and nice way of doing that and without knowing why you want to do that I would guess "you are doing it wrong". There are some hackish ways that you might be able to get the value but they are likely to be error prone. Can you elaborate on why you want to do it that way? Do you want to display the error? Do you want to ignore the error? -Chris On Mon, Dec 26, 2011 at 5:12 PM, Daniel Lepage <[email protected]> wrote: > Hi everyone, > > Is there a way to get the python values for successful fields in a > Schema when other fields have failed? > > For example, suppose I have the following schema and input value: > > sch = Schema(fields=dict(x=Int(), y=DateConverter(), z=Int())) > v = dict(x='12', y='1/16/1973', z='foo') > > I'd like to validate v against sch in such a way that I get not only > the error message from z, but also the values 12 and datetime(1973, 1, > 16) from x and y, respectively. > > Is there a way to do this? > > None of my use cases rely on chained_validators, so all I need are the > values computed by the fields of the schema. > > Thanks, > Dan Lepage > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > FormEncode-discuss mailing list > FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/formencode-discuss -- Christopher Lambacher [email protected] ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev