Re: settings imported twice Was: logging & MODPYTHON

2008-03-06 Thread Thomas Guettler
> Something like that should work though: > > try: > reimported = imported > raise Exception, "already imported!" > catch NameError: > imported = True > > Sorry, if __name__ is different, this won't help, too. The python interpreter thinks that there are two different modules. On

Re: settings imported twice Was: logging & MODPYTHON

2008-03-05 Thread Graham Dumpleton
One more thing, as much as I hate use of os.environ and DJANGO_SETTINGS_MODULE, this could be avoided if the point which was importing 'settings' instead did: settings = __import__(os.environ["DJANGO_SETTINGS_MODULE"]) That way it is ensuring that it is importing it via same dotted module path

Re: settings imported twice Was: logging & MODPYTHON

2008-03-05 Thread Graham Dumpleton
On Mar 6, 2:45 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Malcolm Tredinnick schrieb:> On Wed, 2008-03-05 at 15:32 +0100, Thomas > Guettler wrote: > > [...] > > >> No, it gets imported more then once: (Answer of Malcolm): > >>http://www.mail-archive.com/[EMAIL PROTECTED]/msg39061.html > > >

Re: settings imported twice Was: logging & MODPYTHON

2008-03-05 Thread Patryk Zawadzki
On Wed, Mar 5, 2008 at 4:45 PM, Thomas Guettler <[EMAIL PROTECTED]> wrote: > to Patryk: Look at your code again, it will never raise: > > ''' > imported = False > if imported: > raise Exception, "already imported!" > ... > > ''' Well, obviously I need more coffee. Something like that s

settings imported twice Was: logging & MODPYTHON

2008-03-05 Thread Thomas Guettler
Malcolm Tredinnick schrieb: > On Wed, 2008-03-05 at 15:32 +0100, Thomas Guettler wrote: > [...] > >> No, it gets imported more then once: (Answer of Malcolm): >> http://www.mail-archive.com/[EMAIL PROTECTED]/msg39061.html >> > > Read that carefully and you'll see the answer I have was "may