On Thu, 2011-02-17 at 02:44 -0800, Daniel Roseman wrote:
> > could you elaborate on this? I am suffering from this misconception.
> >
> Not sure what else to say. Taking mod_wsgi as an example, Apache
> spawns a 
> number of processes and/or threads to serve Django requests, depending
> on 
> your mod_wsgi settings. Each of these is long-running, in the sense
> that 
> they are not tied to a specific request/response cycle - again,
> depending on 
> your configuration, they can either persist indefinitely (until
> Apache 
> itself is restarted), or for a specified number of requests. So
> anything 
> that's imported, or set as a variable in the global or module-level
> context, 
> will also persist for multiple requests.
> 
> This is why you often see issues where people set the default for a
> field, 
> for example, to datetime.datetime.now(), and then get the exact same
> default 
> for all items until the server is restarted: because that function is 
> evaluated when the class is defined, and the value persists until the 
> process is killed. (The solution, of course, is to use the callable
> itself 
> without calling it: datetime.datetime.now.) And it's also why the
> developers 
> of the new class-based views functionality in 1.3 had such trouble and
> went 
> to such great lengths to avoid data leaking from one request to the
> next. 

thanks for taking the trouble to reply - will chew on this. 
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to