Re: Custom annotations on error emails

2006-03-28 Thread Ned Batchelder




I guess I don't have a clear opinion on the best way to do it.  Keep it
in mind, and maybe another data point will make the decision clear. 
For now, I've used an egregious hack (I've stuffed the data I want to
see into a META field so the default processing will show it to me!).

--Ned
[EMAIL PROTECTED]

Adrian Holovaty wrote:

  On 3/27/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
  
  
I'd like to add some custom annotations on the traceback emails that get
sent when an exception occurs and DEBUG = False.  For example, we are
using our own user representation, and would like to include the user
identity in the traceback.

I can hack into the code that generates these emails, but I'd rather do
it as a hook of some sort.  Has this been done before?  Should I create
a new kind of hook (ERROR_ANNOTATER) to go alonside middleware and
context processors?  Have I overlooked a simple way to accomplish this
already?

  
  
Would the process_exception() middleware hook work for you?

http://www.djangoproject.com/documentation/middleware/#process-exception

It doesn't override the sending of the error e-mail, but you could do
a separate logging of the user information, I guess. Alternatively, we
might be able to move the standard error e-mailing bit into a
middleware of its own, so it can be overridden. If neither of those
solutions work, we could add a specific hook for this, too. Let us
know what you think!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com




.

  


-- 
Ned Batchelder, http://nedbatchelder.com


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---





Re: Custom annotations on error emails

2006-03-27 Thread Adrian Holovaty

On 3/27/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> I'd like to add some custom annotations on the traceback emails that get
> sent when an exception occurs and DEBUG = False.  For example, we are
> using our own user representation, and would like to include the user
> identity in the traceback.
>
> I can hack into the code that generates these emails, but I'd rather do
> it as a hook of some sort.  Has this been done before?  Should I create
> a new kind of hook (ERROR_ANNOTATER) to go alonside middleware and
> context processors?  Have I overlooked a simple way to accomplish this
> already?

Would the process_exception() middleware hook work for you?

http://www.djangoproject.com/documentation/middleware/#process-exception

It doesn't override the sending of the error e-mail, but you could do
a separate logging of the user information, I guess. Alternatively, we
might be able to move the standard error e-mailing bit into a
middleware of its own, so it can be overridden. If neither of those
solutions work, we could add a specific hook for this, too. Let us
know what you think!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Custom annotations on error emails

2006-03-27 Thread Ned Batchelder

I'd like to add some custom annotations on the traceback emails that get 
sent when an exception occurs and DEBUG = False.  For example, we are 
using our own user representation, and would like to include the user 
identity in the traceback. 

I can hack into the code that generates these emails, but I'd rather do 
it as a hook of some sort.  Has this been done before?  Should I create 
a new kind of hook (ERROR_ANNOTATER) to go alonside middleware and 
context processors?  Have I overlooked a simple way to accomplish this 
already?

Alternatively, if I could override the request class used, or the 
__repr__ implementation of the request class, then I could accomplish 
what I want.

-- 
Ned Batchelder, http://nedbatchelder.com

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---