> Now my question is, which is the preferred way to
> attach this cache to the application? Should I
> subclass it? I don't see a method to attach objects
> to the Application object...
The cleanest way to do it right now is undocumented because it's still
being thought out. But it works well for what you're talking about, and
that's the Cans system. It's supposed to be like beans in Java.
Basically, you write a class that does whatever you need done. It could
be a simple dictionary type object. In your Servlet, you call
self.getCan(ID, class, scope, arguments). Scope is where you want the
object to be stored, Application, Session, Request. Class is the
filename and the classname in that sourcefile. ID is how you will refer
to the object in the future. This function will check the scope to see
if the object with that ID already exists, and if so, returns it, and if
not it creates it. See Page.py and Servlet.py for documentation. JUst
put your class in the Cans directory and go. There's an example of this
in the PSPExamples context.
Other than that, Honestly, just assign it to Application. You can
subclass Application if you want, but remember that Python is completely
dynamic. I would probably just add a line at the end of
Application.__init__() that sets up your cache. Servlets can access the
Application object through self.application().
So, you might add the following line to the end of
self.MyDBCache = SetupMyDBCacheAndReturnAnInstance()
Then in your servlets, just add the following to their awake() method:
self.cache = self.application().MyDBCache
Remember, though, that Webware is multithreaded.
> Also, this might sound dumb, but, what is your
> favorite IDE or editor under Linux to develop Python
> apps? Kedit and Kwrite don't cut it and emacs is too
> foreign to me (I don't want to go thru the learning
> curve of new editing ctrl-c+???? commands).
I recommend learning XEmacs. It's well worth the time. BUt, the other
great option is Idle, which comes with python.