[ckan-dev] what is the Missing class used for?

Ian Ward ian at excess.org
Sat Sep 7 13:06:38 UTC 2013


Hi Dave,

That's right, Missing is not an exception it's the class for an object
used to represent fields not passed:
ckan.lib.navl.dictization_functions.missing. I made some notes the
last time I was working through that code:
https://github.com/okfn/ckan/wiki/Converters-and-Validators-in-navl-Schemas

Ian

On Sat, Sep 7, 2013 at 1:41 AM, Dave Caraway <dave at fogmine.com> wrote:
> Figured it out, I think. The Missing class is used for ignore_missing,
> ignore_empty and other validator functions defined in
> ckan.lib.navl.validators. Note that these should not be confused with
> validators defined in the formencode library, which is also used for HTML
> form validation.
>
>
>
>
>
> On Fri, Sep 6, 2013 at 5:26 PM, Dave Caraway <dave at fogmine.com> wrote:
>>
>> Hi everyone,
>>
>> Can anyone explain where instances of the Missing class (an exception) in
>> ckan.lib.navl.dictization_functions.py should be propagated to? Right now
>> they are going uncaught, resulting in a server error for me. Wondering if I
>> should just catch them and add a message to the error object.
>>
>> code snippet from ckan.lib.navl.dictization_functions.py:
>>
>> class Missing(object):
>>     def __unicode__(self):
>>         raise Invalid(_('Missing value'))
>>     def __str__(self):
>>         raise Invalid(_('Missing value'))
>>     def __int__(self):
>>         raise Invalid(_('Missing value'))
>>     def __complex__(self):
>>         raise Invalid(_('Missing value'))
>>     def __long__(self):
>>         raise Invalid(_('Missing value'))
>>     def __float__(self):
>>         raise Invalid(_('Missing value'))
>>     def __oct__(self):
>>         raise Invalid(_('Missing value'))
>>     def __hex__(self):
>>         raise Invalid(_('Missing value'))
>>     def __nonzero__(self):
>>         return False
>>
>>
>> Thanks!
>> -Dave
>>
>> --
>> Dave Caraway
>> Owner
>> Fog Mine
>> dave at fogmine.com
>> Cell: (937) 985-0867
>> Fax: (866) 238-3120
>
>
>
>
> --
> Dave Caraway
> Owner
> Fog Mine
> dave at fogmine.com
> Cell: (937) 985-0867
> Fax: (866) 238-3120
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>




More information about the ckan-dev mailing list