On May 14, 9:38 pm, Zhang Huangbin <[email protected]> wrote:
 > On May 13, 5:24 pm, Anand Chitipothu <[email protected]> wrote:
 >
 > > Try this if you want to disable debug error, but want to get the debug
 > > error as email:
 >
 > > app.internalerror = web.emailerrors('jo...@...', 
web.webapi._InternalError)
 >
 > Why sender and recipient address are same?
 >
 > ----
 > To: the bugfixer <www(at)a.cn>
 > From: your buggy site <www(at)a.cn>
 > ----

Patch attacted.

Add from_address and to_address, escape with utils.safestr().

-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS, Debian:
  http://code.google.com/p/iredmail/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

--- web/debugerror.py	2009-03-12 21:19:04.000000000 +0800
+++ web/debugerror.py	2009-05-14 22:07:17.000000000 +0800
@@ -13,7 +13,7 @@
 import sys, urlparse, pprint, traceback
 from net import websafe
 from template import Template
-from utils import sendmail
+from utils import sendmail, safestr
 import webapi as web
 
 import os, os.path
@@ -298,7 +298,7 @@
     """
     return web._InternalError(djangoerror())
 
-def emailerrors(email_address, olderror):
+def emailerrors(from_address, to_address, olderror):
     """
     Wraps the old `internalerror` handler (pass as `olderror`) to 
     additionally email all errors to `email_address`, to aid in 
@@ -315,7 +315,6 @@
         tb_txt = ''.join(traceback.format_exception(*tb))
         path = web.ctx.path
         request = web.ctx.method+' '+web.ctx.home+web.ctx.fullpath
-        eaddr = email_address
         text = ("""\
 ------here----
 Content-Type: text/plain
@@ -331,8 +330,8 @@
 
 """ % locals()) + str(djangoerror())
         sendmail(
-          "your buggy site <%s>" % eaddr,
-          "the bugfixer <%s>" % eaddr,
+          "your buggy site <%s>" % safestr(from_address),
+          "the bugfixer <%s>" % safestr(to_address),
           "bug: %(error_name)s: %(error_value)s (%(path)s)" % locals(),
           text, 
           headers={'Content-Type': 'multipart/mixed; boundary="----here----"'})

Reply via email to