Hello Peter,

I believe you can catch the instance in a middleware class. I'm sure a
better developer or someone on the core team can explain better than me.

Jamie Rumbelow 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of PB
Sent: 08 March 2009 12:54
To: Django developers
Subject: Request Signals


Hi,

I've been looking at ways to add more dynamic logging to my
applications and naturally looked to the django signals as a way to do
it.

I'm unsure of the logic behind the request handler class being
returned in the request_finished and request_started signals, rather
than the actual instance. I was wondering if some more enlightened
developer could explain the logic behind such a decision - one of the
lines of code in question is in core.handlers.wsgi line 246:

   signals.request_finished.send(sender=self.__class__)

I'm pondering why the instance itself is not sent, as this would
contain lots of pertinent information.

I'm speculating it could be for a few reasons - to ensure that the
handler is garbage collected after each request - if loads of pointers
are floating about, then a badly written signal handler could cause
some sort of memory leak? Or perhaps to avoid a signal handler
mutating the request handler?

Either way - it'd be useful to actually have the instance available -
I'm interested to whether I guessed the reasons right?

Thanks,

Peter

(I deliberated whether this was a django-users question, but as I'm
more interested in the motivation of the decision rather than a fix, I
figured this was the right place)

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.11.9/1989 - Release Date: 03/07/09
18:43:00


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to