PageRenderTime 15ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/kai/templates/tracebacks/index.mako

https://bitbucket.org/bbangert/kai/
Mako | 55 lines | 52 code | 3 blank | 0 comment | 5 complexity | 2d31347376718b5a4c1f49fb8688b531 MD5 | raw file
 1<div class="yui-b content">
 2    <%
 3    if c.tracebacks:
 4        results = list(c.tracebacks)
 5    if c.reverse:
 6        results.reverse()
 7    %>
 8    % if c.tracebacks:
 9        ${widgets.pager(c.start, results, c.tracebacks.total_rows, 'created')}
10        <h1>Posted Tracebacks</h1>
11        
12        % for traceback in results[:10]:
13        <% frame = traceback.frames[-1] %>
14        <div class="exception">
15            <h2 class="exception"><a href="${url('traceback', id=traceback.id)}">\
16                ${traceback.exception_type} : ${h.truncate(traceback.exception_value, 100)}</a></h2>
17            <div class="traceback_posted">
18                <div class="traceback_gravatar">\
19                    <img src="http://www.gravatar.com/avatar/${gravatar(traceback.email or 'anonymous')}?s=30">
20                </div>
21                <div class="user_data">
22                    <div class="traceback_author">${traceback.displayname or 'Anonymous'}</div>\
23                    ${widgets.format_timestamp(traceback.created)}
24                </div>
25                </div>
26            <div class="exception_frame">
27                <div class="frame">Last Frame:</div>
28                <div class="moduleline">${frame.module}:\
29                    <span class="lineno">${frame.line}</span>\
30                    in ${frame.function}
31                </div>
32                ${highlight(frame.operation, py_lexer, html_formatter) | n}\
33            </div>
34        </div>
35        % endfor
36    % else:
37    <h1>Posted Tracebacks</h1>
38    
39    <p>No tracebacks posted</p>
40    % endif
41</div>
42<%namespace name="widgets" file="/widgets.mako"/>
43<%def name="title()">${parent.title()} - Traceback Listing</%def>\
44<%inherit file="../layout.mako" />\
45<%!
46from pygments import highlight
47from pygments.lexers import PythonLexer
48from pygments.formatters import HtmlFormatter
49import md5
50def gravatar(email):
51    return md5.md5(email).hexdigest()
52
53py_lexer = PythonLexer()
54html_formatter = HtmlFormatter()
55%>