[Web-SIG] Standardized configuration

Phillip J. Eby pje at telecommunity.com
Sun Jul 24 17:29:30 CEST 2005


At 04:05 AM 7/24/2005 -0400, Chris McDonough wrote:
>- OR (if we passed the factory a namespace instead of a filename) -
>
>   [foo.factory]
>   arbitrarykey1 = arbitraryvalue1
>   arbitrarykey2 = arbitraryvalue2
>
>   [bar.factory]
>   arbitrarykey1 = arbitraryvalue1
>   arbitrarykey2 = arbitraryvalue2

This one's my favorite.  I'd say the semantics are that each factory gets 
passed the key/value pairs as keyword arguments, with a positional argument 
used to pass in the "next application".  The last factory in the file 
wouldn't get the positional argument.

If a section's name has len(sectionName.split())>1, then the second and 
subsequent words are directives that change the default interpretation of 
the section, so that we can have things like:

     [WSGI options]
     # WSGI options, like required eggs, threading mode, etc.

     [mod_python options]
     # mod_python-specific options

     [some.app object]
     # this app is an object, not a factory

I don't care that ConfigParser doesn't support any of this, because 
low-level .ini parsers are easy to write and I've previously written two: 
one for peak.config and one for pkg_resources.  And if the implementation 
can assume pkg_resources is available, it can use the one that's there to 
do the sequential section-splitting part of the job.

I'm not sure of this, but I tend towards thinking that the 
'arbitraryvalues' should be Python expressions, rather than raw strings.  I 
also think that we should support a source-encoding comment to allow for 
localization of Unicode literals, whether we treat values as raw strings or 
Python expressions.



More information about the Web-SIG mailing list