def emailerrors(to_address, olderror, from_address=None):
 from_address = (from_address or to_address)
 def emailerrors_internal():
  error = olderror()
  tb = sys.exc_info()
  error_name = tb[0]
  error_value = tb[1]
  tb_txt = ''.join(traceback.format_exception(*tb))
  path = web.ctx.path
  request = (((web.ctx.method + ' ') + web.ctx.home) + web.ctx.fullpath)
  message = ('\n%s\n\n%s\n\n' % (request, tb_txt))
  sendmail(('your buggy site <%s>' % from_address), ('the bugfixer <%s>' % to_address), ('bug: %(error_name)s: %(error_value)s (%(path)s)' % locals()), message, attachments=[dict(filename='bug.html', content=safestr(djangoerror()))])
  return error
 return emailerrors_internal

def emailerrors ( to_address , olderror , from_address = None ) : from_address = ( from_address or to_address ) def emailerrors_internal ( ) : error = olderror ( ) tb = sys . exc_info ( ) error_name = tb [ 0 ] error_value = tb [ 1 ] tb_txt = '' . join ( traceback . format_exception ( * tb ) ) path = web . ctx . path request = ( ( ( web . ctx . method + ' ' ) + web . ctx . home ) + web . ctx . fullpath ) message = ( '\n%s\n\n%s\n\n' % ( request , tb_txt ) ) sendmail ( ( 'your buggy site <%s>' % from_address ) , ( 'the bugfixer <%s>' % to_address ) , ( 'bug: %(error_name)s: %(error_value)s (%(path)s)' % locals ( ) ) , message , attachments = [ dict ( filename = 'bug.html' , content = safestr ( djangoerror ( ) ) ) ] ) return error return emailerrors_internal
wraps the old internalerror handler to additionally email all errors to to_address .