コード例 #1
0
ファイル: utils.py プロジェクト: 10sr/jottit
    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----"'})
コード例 #2
0
ファイル: emailerror.py プロジェクト: fidlej/jakybyt
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)
コード例 #3
0
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)
コード例 #4
0
ファイル: ol_infobase.py プロジェクト: termim/openlibrary
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()
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
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)
コード例 #8
0
ファイル: utils.py プロジェクト: Roverok/CloudMining
def email_errors():
    if web.config.email_errors:
        web.emailerrors(web.config.email_errors, web.djangoerror())
コード例 #9
0
ファイル: utils.py プロジェクト: Shadiq999/Cloudmin
def email_errors():
    if web.config.email_errors:
        web.emailerrors(web.config.email_errors, web.djangoerror())