[Python-checkins] r65325 - in tracker/roundup-src/roundup: cgi/client.py mailer.py

martin.v.loewis python-checkins at python.org
Thu Jul 31 08:13:08 CEST 2008


Author: martin.v.loewis
Date: Thu Jul 31 08:13:08 2008
New Revision: 65325
Log:
Put request information into exception emails.
Modified:
 tracker/roundup-src/roundup/cgi/client.py
 tracker/roundup-src/roundup/mailer.py
Modified: tracker/roundup-src/roundup/cgi/client.py
==============================================================================
--- tracker/roundup-src/roundup/cgi/client.py	(original)
+++ tracker/roundup-src/roundup/cgi/client.py	Thu Jul 31 08:13:08 2008
@@ -380,9 +380,21 @@
 if self.instance.config.WEB_DEBUG:
 self.write_html(cgitb.html(i18n=self.translator))
 else:
- self.mailer.exception_message()
+ self.mailer.exception_message(self.exception_data())
 return self.write_html(self._(error_message))
 
+ def exception_data(self):
+ result = ''
+ try:
+ for k,v in self.env.items():
+ result += "%s=%s\n" % (k,v)
+ for k,v in self.request.headers.items():
+ result += "%s=%s\n" % (k,v)
+ result += "user:" + repr(self.user) + "\n"
+ except:
+ pass
+ return result
+
 def clean_sessions(self):
 """Age sessions, remove when they haven't been used for a week.
 
Modified: tracker/roundup-src/roundup/mailer.py
==============================================================================
--- tracker/roundup-src/roundup/mailer.py	(original)
+++ tracker/roundup-src/roundup/mailer.py	Thu Jul 31 08:13:08 2008
@@ -161,14 +161,14 @@
 # because of spam)
 pass
 
- def exception_message(self):
+ def exception_message(self, data=''):
 '''Send a message to the admins with information about the latest
 traceback.
 '''
 subject = '%s: %s'%(self.config.TRACKER_NAME, sys.exc_info()[1])
 to = [self.config.ADMIN_EMAIL]
 content = '\n'.join(traceback.format_exception(*sys.exc_info()))
- self.standard_message(to, subject, content)
+ self.standard_message(to, subject, data+content)
 
 def smtp_send(self, to, message):
 """Send a message over SMTP, using roundup's config.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /