From 5f4a61091fc78771439567b9126ce9ff087f43a7 Mon Sep 17 00:00:00 2001 From: gdetrez Date: Wed, 6 Dec 2006 00:09:12 +0100 Subject: [PATCH] ajout du traceback dans les mails d'erreur darcs-hash:20061205230912-f46e9-0d8063a49a299ee92dee2698670b4ba8c19eb946.gz --- intranet/Root.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/intranet/Root.py b/intranet/Root.py index 985dcc69..84adf59a 100755 --- a/intranet/Root.py +++ b/intranet/Root.py @@ -27,6 +27,7 @@ import cherrypy, sys, os, datetime +import crans.utils.exceptions sys.path.append('/usr/scripts/gestion/') @@ -131,16 +132,22 @@ class Intranet: info.exposed = True def send_error_repport(self, **kw): + + # on récupère tout de suite le traceback + tb = crans.utils.exceptions.formatExc() + # entêtes du mail exp = "intranet" dest = cherrypy.config.get("mail.bugreport", "nounous@crans.org") subject = "Rapport de Bug" text = """ Bonsoir, -Ceci est un rapport de bug envoye depuis l'intranet. +Ceci est un rapport de bug envoye par l'intranet. %s """ % "\n".join( [ "%s: %s" % (str(a), str(kw[a])) for a in kw] ) + + #On ajoute des variables de cherrypy text += "\n= Cherrypy vars =\n" try: text += "url: %s\n" % cherrypy.request.browser_url @@ -150,10 +157,6 @@ Ceci est un rapport de bug envoye depuis l'intranet. text += "headers: \n %s\n" % "\n".join( [" %s: %s" % (str(a), str(cherrypy.request.headers[a])) for a in cherrypy.request.headers] ) except: pass - try: - text += "request_line: %s\n" % cherrypy.request.request_line - except: - pass try: text += "query_string: %s\n" % cherrypy.request.query_string except: @@ -163,6 +166,14 @@ Ceci est un rapport de bug envoye depuis l'intranet. except: pass + + # on ajoute le traceback + text += "\n= Traceback =\n" + text += tb + + #on signe, quand même ! + text += "\n-- \nRoot.py pour l'intranet\n" + quickSend(exp, dest, subject, text) return self.index()