def emailerrors_internal(): 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 eaddr = email_address text = ("""\ ------here---- Content-Type: text/plain Content-Disposition: inline %(request)s %(tb_txt)s ------here---- Content-Type: text/html; name="bug.html" Content-Disposition: attachment; filename="bug.html" """ % locals()) + str(web.djangoerror()) sendmail( "your buggy site <%s>" % eaddr, "the bugfixer <%s>" % eaddr, "bug: %(error_name)s: %(error_value)s (%(path)s)" % locals(), text, headers={'Content-Type': 'multipart/mixed; boundary="----here----"'})
def internalerror(): if config.DEBUG: return web.debugerror() web.header('Content-Type', 'text/html; charset=utf-8', unique=True) web.ctx.status = "500 Internal Server Error" print 'internal server error' page = web.djangoerror() _inform(page)
def save_error(dir, prefix): try: logger.error("Error", exc_info=True) error = web.djangoerror() now = datetime.datetime.utcnow() path = '%s/%04d-%02d-%02d/%s-%02d%02d%02d.%06d.html' % (dir, \ now.year, now.month, now.day, prefix, now.hour, now.minute, now.second, now.microsecond) logger.error("Error saved to %s", path) write(path, web.safestr(error)) except: logger.error("Exception in saving the error", exc_info=True)
def save_error(dir, prefix): try: import traceback traceback.print_exc() error = web.djangoerror() now = datetime.datetime.utcnow() path = '%s/%04d-%02d-%02d/%s-%02d%02d%02d.%06d.html' % (dir, \ now.year, now.month, now.day, prefix, now.hour, now.minute, now.second, now.microsecond) print >> web.debug, 'Error saved to', path write(path, web.safestr(error)) except: import traceback traceback.print_exc()
def save_error(): t = datetime.datetime.utcnow() name = '%04d-%02d-%02d/%02d%02d%02d%06d' % (t.year, t.month, t.day, t.hour, t.minute, t.second, t.microsecond) path = infogami.config.get('errorlog', 'errors') + '/'+ name + '.html' dir = os.path.dirname(path) if not os.path.exists(dir): os.makedirs(dir) error = web.safestr(web.djangoerror()) f = open(path, 'w') f.write(error) f.close() print >> web.debug, 'error saved to', path return name
def save_error(): t = datetime.datetime.utcnow() name = '%04d-%02d-%02d/%02d%02d%02d%06d' % ( t.year, t.month, t.day, t.hour, t.minute, t.second, t.microsecond) path = infogami.config.get('errorlog', 'errors') + '/' + name + '.html' dir = os.path.dirname(path) if not os.path.exists(dir): os.makedirs(dir) error = web.safestr(web.djangoerror()) f = open(path, 'w') f.write(error) f.close() print('error saved to', path, file=web.debug) return name
def save_error(dir, prefix): try: logger.error("Error", exc_info=True) error = web.djangoerror() now = datetime.datetime.utcnow() path = '%s/%04d-%02d-%02d/%s-%02d%02d%02d.%06d.html' % ( dir, now.year, now.month, now.day, prefix, now.hour, now.minute, now.second, now.microsecond, ) logger.error('Error saved to %s', path) write(path, web.safestr(error)) except Exception: logger.error('Exception in saving the error', exc_info=True)
def email_errors(): if web.config.email_errors: web.emailerrors(web.config.email_errors, web.djangoerror())