Well, as long as you are doing things correctly, then Python will be thread
safe and thus you can place a "global" definition in your middleware (global
grequest; grequest=request), then create a function which does "global
grequest; return grequest". I have used this method for quite some time, and
it has proven sound so far. This should also work incrementing values.

If you want the incremented value to be across multiple deployments, you
could use memcached (which supports atomic operations), then do grequest_inc
= cache.incr('grequestcount', 1).

Hope this makes sense!

On Tue, Feb 15, 2011 at 4:58 PM, Bzyczek <[email protected]> wrote:

> > I am not aware of anything, but you can easily make a piece of middleware
> > which generated a UUID then exposed this in the request object :)
>
> Yes I could, but then I must provide to all parts of my code request
> object. I don't know how to build something like "global variable",
> which will be safe regardless on server configuration (many
> procesesses/threads of my app).
>
> Michal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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

Reply via email to