At 03:34 PM 12/6/01 -0800, Tavis Rudd wrote:
>you wrote:
> > - Why force all settings into a single file?  I actually liked the
> > fact that settings for different components live in different
> > files, although I suppose I wouldn't mind the _option_ of combining
> > them into a single file.  In Python source format this could be
> > done with class syntax like this:
> >
> > class AppServer:
> >       setting1 = 'foo'
> >       setting2 = 'bar'
> >
>
>class HTTPServer:
>         setting1 = 'qux'
>
>The best of both worlds - bloody good idea!  This layout would make
>it possible to use a single file or multifile layout!!
>
>If we just make WebKit and all other Webware components
>"""import webware_config""" to get their settings we can use a single
>'webware_config.py' module or 'webware_config/' package.  Both look
>the same to Python.  WebKit would have settings in
>webware_config.WebKit, UserKit would have them in
>webware_config.UserKit, and so on.  If we use the 'class whatever:'
>scheme you suggested, the settings for WebKit could be in the module
>webware_config.WebKit OR the class WebKit in the module
>webware_config.  The settings for AppServer could be in
>the module webware_config.WebKit.AppServer or in the class AppServer
>inside the webware_config.WebKit module.  And so on ...

I hadn't thought of doing config settings as a package, but that's 
definitely the cleanest way to have a directory full of config files, OR a 
single file.

...

>The keyword 'class' might be a bit misleading as we're not promissing
>1-to-1 mappings to actual classes, but that's no big deal either.  In
>fact, we can use anything that supports __getatrr__ and __setattr__
>for the settings containers: modules, classes, objects, etc.  This is
>much cleaner than dictionaries!

I agree, I definitely prefer regular Python assignments over 
dictionaries.  But it would be nice to allow both, if only to ease the 
transition.

>One of the key features of the 'webkit' launcher script is that it
>can be launched from any directory and will find the appropriate
>config file, or use the one specified as an argument to the command.
>This proposal wouldn't affect the latter case, but if we used pure
>python imports to get the settings we'd probably have to do some
>temporary sys.path manipulation to make sure the correct
>'webware_config' is imported in the former.
>
>The current search order for config files is
>['.webkit_config',
>os.path.join(os.path.expanduser('~'),
>             '.webkit_config'),
>'/etc/webkit_config'
>]
>
>Your thoughts?

I'm not sure I agree that it should search for the config file at 
all.  Explicit is better than implicit, and in this case I think it's 
better to know exactly where your config settings are coming from, by 
specifying it right on the command line.  You can always use a bash or .bat 
wrapper to avoid having to retype it every time.


--

- Geoff Talvola
   [EMAIL PROTECTED]

_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to