Great information, this is exactly what I needed.
So if I am understanding this correctly then there is limited danger in keeping modules in the context directory. Once my code
imports them there is no danger if the user somehow types in a URL that causes webware to load a module.
----- Original Message -----
From: "Ian Bicking" <ianb@...>
Sent: Wednesday, October 10, 2001 4:32 AM
Subject: Re: [Webware-discuss] How to load a module and 'Best Practice'
> "Aaron Held" <aaron@...> wrote:
> > in a webware servlet write:
> > from config import datapool
> > Then does the datapool get reinitialized every page?
> No, when a module is reimported, it is not reexecuted.
> > If it does not then is datapool a application level object or a
> > context level one?
> Module-level, which means interpreter-level, which also means
> application-level; though you still must always import it (but that
> doesn't reexecute it).
> > How can I use __init__.py to initialize the database connection?
> > can I just import config from __init__.py
> I'm not sure if this will put the binding in your namespace -- I don't
> think it will. So you'd have to have something like "from thisContext
> import datapool". It is Python's nature not to automatically set
> anything up for you.
> > I used MakeAppWorkDir.py (thanks for editing the oneshot webware
> > path in that script!) where do I put site specific vs module
> > specific modules?
> I assume you mean site specific vs. context specific? You might want
> to make a directory off of Webware/ for your site-wide modules. You
> can also import modules from other contexts, you should just use the
> complete path (from Bill.SomeModule import Something).