On 28/06/2015 06:29, Mike Orr wrote:
On Tue, Jun 23, 2015 at 12:55 PM, Jon Rosebaugh <j...@inklesspen.com> wrote:
Around last December, I got annoyed with the way PasteDeploy combines the
INI file parsing with the WSGI object loading. INI files are awfully clumsy
and there are many alternatives that offer features such as lists and nested
dicts, but as long as WSGI object loading was done through PasteDeploy,
Pyramid could not easily take advantage of these config formats.
Hey, I was just thinking that last week, that maybe it would be worth
switching to YAML or JSON config files. I thought I would have to
write the glue code myself. I have a validator that I call from my
main function that validates the settings and converts their types. I
want any invalid settings to raise an exception at startup, not when
they're used in some obscure request. I've also got a fair amount of
list parsing and nested data structures and extra INI sections. It
takes a significant amount of code and deciding how to express these
in a setting or a section and write unit tests for them. I've found a
section works for something dict-like, and dotted key names can be
used for nested dicts or objects, but it's more cumbersome than
expressing them directly in YAML or JSON. I also have to create a
ConfigParser myself to read the section, and set the 'here' or
'__file__' key if I need them. Thanks for publishing Montague; I'll
try it out.

As far as validating config schemas goes, I can highly recommend this library:

https://pypi.python.org/pypi/voluptuous/

Flexible, powerful and easy to use.

Chris

--
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to