Webware 0.7/Singleton pattern

Alex Martelli aleax at aleax.it
Tue Jul 16 04:50:47 EDT 2002


Michael Bub wrote:
        ...
> WebApp built with Webware 0.7 (using Python 2.2 on a FreeBSD4.4
> system), the second or third time the get_instance method is called,
> the one instance that was created by the singleton seems to be
> forgotten about (or rather, it seems as if the file that holds the
> class definition was imported and used for the very first time) and

You may be serving hits in different processes -- that depends in
part on how you're using Webware... it can be installed to work
on top of CGI, and CGI by definition uses a new process each time.

If you want to make SURE, use Borg augmented with saving and
retrieving of instance data (ideally on a decent underlying DB
so you need not worry about synchronization etc).


Alex




More information about the Python-list mailing list