Re: Code exectution and persistent object question

2006-07-05 Thread Iain Duncan
>>Ok, so we're would be smart place to do housekeeping you want to have >>happen no matter what page is loaded? > > > Middleware: http://www.djangoproject.com/documentation/middleware/ > > You can have functions that run prior to a request being passed along, > prior to a view function being

Re: Code exectution and persistent object question

2006-07-05 Thread Malcolm Tredinnick
On Thu, 2006-07-06 at 02:02 -0700, Iain Duncan wrote: > > Separate client hits might hit separate Python interpreter instances, > > and each of those instances will have imported the global namespace on > > their own, creating separate global namespaces. > > > > So like Steven said, it's not

Re: Code exectution and persistent object question

2006-07-05 Thread Iain Duncan
> Separate client hits might hit separate Python interpreter instances, > and each of those instances will have imported the global namespace on > their own, creating separate global namespaces. > > So like Steven said, it's not safe to do anything in the global > namespace. If you need a

Re: Code exectution and persistent object question

2006-07-05 Thread Jay Parlar
On 7/6/06, Iain Duncan <[EMAIL PROTECTED]> wrote: > > > > Code in the global namespace is executed at module import time. > > These variables live as long as the python interpreter runs. (at least > > thats my understanding of it) > > > > This is great for constants and such, but you can't rely

Re: Code exectution and persistent object question

2006-07-05 Thread Iain Duncan
> Code in the global namespace is executed at module import time. > These variables live as long as the python interpreter runs. (at least > thats my understanding of it) > > This is great for constants and such, but you can't rely on it to store > state variables as, depending on the

Re: Code exectution and persistent object question

2006-07-04 Thread Steven Armstrong
On 07/05/06 03:34, Iain Duncan wrote: > I stumbled on some behaviour that I'm sure is explained somewhere but > not in the tutorials so I haven't found it. > > I made a global log object for debugging. I noticed instantiating > objects in the view global name space executes before anything else

Code exectution and persistent object question

2006-07-04 Thread Iain Duncan
I stumbled on some behaviour that I'm sure is explained somewhere but not in the tutorials so I haven't found it. I made a global log object for debugging. I noticed instantiating objects in the view global name space executes before anything else in the views module on page load, very useful