|
From: Michael F. <fuz...@vo...> - 2010-07-28 11:35:58
|
On 28/07/2010 12:16, Tom wrote:
> Hi,
>
> i use a configspec and want to validate a string_list. How to do this?
>
> My configspec contains:
> days = list(min=7, max=7, default=list('Mon', 'Tue', 'Wed', 'Thu',
> 'Fri', 'Sat', 'Sun'))
>
>
> How can i check that the days-list only contains possible values (like
> Mon) and not something like 'testday' ?
>
> What i need is something like a multioption list.
>
> I want to use this for a web-interface with checkboxes.
>
Hello Tom,
validate doesn't include an "option list" validation built in, but it
would be very easy to add. See this article on writing and using custom
validators and look at the validate source code (very short) for some
examples:
http://www.voidspace.org.uk/python/articles/configobj.shtml#writing-a-custom-check
All the best,
Michael Foord
>
> Cheers,
>
> Tom
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
|