|
From: Michael F. <fuz...@vo...> - 2009-02-19 20:11:49
|
David Hostetler wrote:
> I have the newline support implemented (with tests).
>
> Would you prefer a diff, or just the validate.py?
Diff against svn head is perfect.
Michael
>
> cheers,
>
> -hoss
>
> On Wed, Jan 28, 2009 at 18:17, Michael Foord
> <fuz...@vo... <mailto:fuz...@vo...>> wrote:
>
> David Hostetler wrote:
> > I'm having a devil of a time getting validate to allow for the
> default
> > value of a string check to consist of a string that includes a
> newline
> > character ('\n'). I've tried several syntactic variants, and
> nothing
> > is working - the validation fails everytime.
> >
> > E.g.:
> >
> > spec = { u'val': u"string(default='%s')" % ('\n') }
> > cfgdict = {}
> >
> > vtor = validate.Validator()
> > cfg = configobj.ConfigObj(cfgdict, configspec=spec)
> >
> > results = cfg.validate(vtor, preserve_errors=True)
> >
> > In addition to the spec as shown above, I've tried:
> >
> > spec = { u'val': u"string(default='\n')" }
> >
> > spec = { u'val': u""""string(default='
> > ')""" }
> >
> >
> > I even tried putting the spec into a text block and using
> splitlines()
> > and giving that as the configspec argument (where the text block
> used
> > the '''<value>''' syntax for multi-line values).
> >
> > No joy.
> >
> > The validation parser seems to treat any newline as the end of the
> > spec definition for that particular value, and either bombs out
> with a
> > parse error, or returns False upon validation.
> >
> > Any tips? Bug?
>
> Hmm... probably the regular expression matching used in validation
> can't
> handle the newlines. Hopefully adding re.DOTALL to some of the regular
> expressions in validate.py will fix it.
>
> I'm unlikely to be able to get to it for a few weeks - so patches
> (including tests!) welcomed. :-)
>
> All the best,
>
>
> Michael Foord
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> 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
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|