From: Tavis R. <ta...@ca...> - 2001-12-07 00:19:29
|
On Thursday 06 December 2001 15:40, Geoffrey Talvola wrote: > At 03:34 PM 12/6/01 -0800, Tavis Rudd wrote: > >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. I've attached a copy of the old .webkit_config_annotated file translated to the proposed format. It seems to work with all versions of Python, not just 2.1 and up. This file contains all the settings and is more complicated than the average user will need so I've also attached an example of what typical config might look like. The SettingsContainer baseclass is used to make sure that settings that are in fact meant to be classes aren't handled as SettingsContainers. In practice a shorter name might be better. Finally, I've attached some simple functions that can be used to get settings out of the SettingsContainers recursively and turn them into dictionaries. > 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. Hmm, I agree, although it should be able to detect a webware_config module or package sitting in the dir that the script is called from. Ok, now back to that PSP stuff ;) Tavis |