>
> self.application().foo should work fine for a 'foo' that you
> create. This
> is ordinary Python after all.
>
> Perhaps there was another problem where the attribute hadn't
> been set yet?
>
Oops, I must have been smokin the crack rock that day. I was using
app.valueForKey('myCache',None) i
At 10:20 AM 6/12/2001 -0400, Jeff Johnson wrote:
>I can't even remember how I found valueForKey() in the first place. I
>wanted to just refer to dbPool with self.application().dbPool but it
>doesn't work so I used valueForKey(). What's the correct way to do
>this?
>
>Hey, I just realized that Ge
> At 01:18 PM 6/11/2001 -0400, Jeff Johnson wrote:
> >If this is right, should some of it be added to the docstring for
> >DBPool? Currently it tells how to create the dbPool but not how to
> >make it persist beyond a single servlet call.
>
> We're at the intersection of a MiscUtils class and how
>
> Another approach is to put your initialization code into a
> regular Python
> module. Then you just import it and use the variable. This
> works because
> modules only get imported once, plus the imports are guaranteed to
be
> thread-safe. For example:
>
> MyDBPool.py:
> from MiscUtils.DBPo
At 01:18 PM 6/11/2001 -0400, Jeff Johnson wrote:
>If this is right, should some of it be added to the docstring for
>DBPool? Currently it tells how to create the dbPool but not how to
>make it persist beyond a single servlet call.
We're at the intersection of a MiscUtils class and how to use it
At 01:18 PM 6/11/2001 -0400, Jeff Johnson wrote:
> > Webware.MiscUtils.DBPool
>
>That'll work for me. This is what I did, let me know if I did it
>wrong:
>
>__init__.py:
>def contextInitialize(app, ctxPath):
> from MiscUtils.DBPool import DBPool
> import pgdb
> app.dbPool