[EMAIL PROTECTED] wrote:
> 
> Ian Bicking wrote:
> 
>>Sometime a while ago someone asked about an option to have the schema
>>fill in values that are missing.  I can't remember who.  Anyway, it took
>>a while, but now it's there in r1218 as an option on Schemas:
>>
>>     # If this is given, then any keys that aren't available but
>>     # are expected  will be replaced with this value (and then
>>     # validated!)  This does not override a present .if_missing
>>     # attribute on validators:
>>     if_key_missing = NoDefault
> 
> 
> This change doesn't fit my usage scenario. What I have is like this :
> 
> a=dict(a set of keyword string values from web page)
> s_a = schema(build from SQLObject data validators)
> s_b = schema(a subset of fields in a, that is not in s_a)
> 
> I want to validate:
> 
> o = s_a.to_python(a)
> o = s_b.to_python(o)
> 
> That is, fill in o in sequence. The problem is, s_a may contains fields
> not in a and I just want it to be skipped as a can be just a subset of
> s_a fields. The current if_key_missing still force me to fill in
> something for keys that I have no interest in this sequence or that it
> may be specified in s_b.

That sounds like you want allow_extra_fields=True,
filter_extra_fields=False.  That will ignore, but pass through, any keys
that are not defined in the schema.


-- 
Ian Bicking  |  [EMAIL PROTECTED]  |  http://blog.ianbicking.org

Reply via email to