Re: ForEach access to parent validators?

Ian Bicking <[email protected]> Tue, 3 Mar 2009 23:16:12 -0600
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Sorry for the late response...

On Fri, Feb 27, 2009 at 8:43 AM, Jason Yamada-Hanff <[email protected]> wrote:
> I am trying to build a validator for checking unique constraints in
> the db.  For this, I'd like access to the parent validator's field
> dictionary from within a nested validator.  Is this possible?

It is possible.  I think a chained validator would probably be more
appropriate for your particular case, but you can also get access to
the other values.  The state object will have attributes assigned to
it, if you don't pass in None (which is the default, though might not
be if you are using a framework).  The full dictionary will then be in
state.full_dict (Schema will just assign the full_dict attribute on
whatever object gets passed in).

-- 
Ian Bicking  |  http://blog.ianbicking.org

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
FormEncode-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-discuss