On Fri, Dec 07, 2001 at 10:55:20AM -0800, Chuck Esterbrook wrote:
> On Friday 07 December 2001 06:05 am, Geoffrey Talvola wrote:
> > As far as naming conventions, these are valid Python
> > modules/packages, so .py would probably be best. ?But it would be
> > nice to be able to identify config files from their filename, so it
> > could look like this for a multiple-file configuration:
> >
> > Configs/
> > ? ? ? ? ?__init__.py
> > ? ? ? ? ?AppServerConfig.py
> > ? ? ? ? ?ApplicationConfig.py
> > ? ? ? ? ?...
> 
> 
> What's the __init__.py for? In other projects I just went with:
> 
> 
> Configs/
>       FooBar.config
> 
> 
> and did an exec on FooBar to get the variables which looked like:
> 
> reps = 50
> names = 'foo bar'.split()
> 
> etc.

        sys.path.insert(0, '/wherever/the/Configs/directory/is')
        from ?.Configs import AppServerConfig
        for ext in AppServerConfig.ExtensionsToCascade:   # Look ma, no 'exec'!
                ...

Without __init__.py, 'Configs' couldn't be imported as a package.

Although if you put the Configs directory directly in the path, you
wouldn't need __init__.py ...

-- 
-Mike (Iron) Orr, [EMAIL PROTECTED]  (if mail problems: [EMAIL PROTECTED])
   http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol

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

Reply via email to