コード例 #1
0
ファイル: utils.py プロジェクト: JinsongBian/pulsar
def render_error_debug(request, exc, content_type):
    '''Render the traceback into the content type in *response*.'''
    response = request.response
    is_html = content_type == 'text/html'
    error = Html('div', cn='section traceback error') if is_html else []
    trace = format_traceback(exc)
    for trace in format_traceback(exc):
        counter = 0
        for line in trace.split('\n'):
            if line.startswith('  '):
                counter += 1
                line = line[2:]
            if line:
                if is_html:
                    line = Html('p', escape(line))
                    if counter:
                        line.css({'margin-left': '%spx' % (20*counter)})
                error.append(line)
    return error
コード例 #2
0
ファイル: utils.py プロジェクト: axisofentropy/pulsar
def render_error_debug(request, exception, is_html):
    '''Render the ``exception`` traceback
    '''
    error = Html('div', cn='well well-lg') if is_html else []
    for trace in format_traceback(exception):
        counter = 0
        for line in trace.split('\n'):
            if line.startswith('  '):
                counter += 1
                line = line[2:]
            if line:
                if is_html:
                    line = Html('p', escape(line), cn='text-danger')
                    if counter:
                        line.css({'margin-left': '%spx' % (20*counter)})
                error.append(line)
    if is_html:
        error = Html('div', Html('h1', request.response.status), error)
    return error
コード例 #3
0
def render_error_debug(request, exception, is_html):
    '''Render the ``exception`` traceback
    '''
    error = Html('div', cn='well well-lg') if is_html else []
    for trace in format_traceback(exception):
        counter = 0
        for line in trace.split('\n'):
            if line.startswith('  '):
                counter += 1
                line = line[2:]
            if line:
                if is_html:
                    line = Html('p', escape(line), cn='text-danger')
                    if counter:
                        line.css({'margin-left': '%spx' % (20 * counter)})
                error.append(line)
    if is_html:
        error = Html('div', Html('h1', request.response.status), error)
    return error
コード例 #4
0
ファイル: utils.py プロジェクト: arhik/pulsar
 def __init__(self, exc):
     self.exc = exc
     self.trace = format_traceback(exc)
コード例 #5
0
ファイル: utils.py プロジェクト: devopsmi/pulsar
 def __init__(self, exc):
     self.exc = exc
     self.trace = format_traceback(exc)