|
From: Michael F. <fuz...@vo...> - 2010-08-25 18:26:12
|
On 25/08/2010 09:47, Tom wrote:
> Hi,
>
> i have a configspec with about 200 lines and validate a simple dict with
> about 5 key/value pairs.
>
> For validation of the dict, i create a new config-obj with the config
> spec (and copy=True), merge the dict into the new config and run the
> validate() method.
> But this is very slow (on an embedded device (400 Mhz)). How can i speed
> up this process? Is it possible to validate only the dict without all
> the other stuff?
You could use the validate library directly. ConfigObj will attempt to
validate against the whole configspec, but you could pull the keys out
of the configspec / dict and only validate against rules you actually
need (I assume this is your intent?).
The documentation for validate can be found at:
http://www.voidspace.org.uk/python/validate.html
You may first need to read your configspec into a ConfigObj instance.
The correct way to do this is:
from configobj import ConfigObj
spec = ConfigObj(filename, list_values=False, _inspec=True)
HTH.
All the best,
Michael Foord
> Cheers,
>
> Tom
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
--
http://www.ironpythoninaction.com/
|