Re: Singleton + Django problem

2007-08-24 Thread James Bennett
On 8/24/07, Rodrigue <[EMAIL PROTECTED]> wrote: > This works fine when I unittest it. But then, I create an instances of > SomeClass in Django and...it does not work...and in the strangest way: > the rest of the initialisation code is executed more than once, but > not everytime. When running und

Singleton + Django problem

2007-08-24 Thread Rodrigue
Hi, I am developing an application based on django that also uses some python modules I have written. My problem is that I need one of my classes to be a singleton. I use this code to do it (mix of Borg and singleton): class SomeClass: _shared_state = {} def __init__(self): self.__dict