This repository was archived by the owner on Jun 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed
Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -2903,6 +2903,22 @@ def reset_exam():
29032903 return json .dumps ({"status" : "Success" , "mess" : "Successfully Reset Exam" })
29042904
29052905
2906+ # This displays the table that collects tickets across workers
2907+ # for this to work you will need to add a row to ``auth_group`` with the role ``admins``
2908+ # In addition any user that you want to have access to these tracebacks will need
2909+ # to have their user_id and the group id for admins added to the ``auth_membership`` table.
2910+ # This will require some manual sql manipulation.
2911+ @auth .requires_membership ("admins" )
2912+ def tickets ():
2913+ ticks = db .executesql (
2914+ """
2915+ select * from traceback order by timestamp desc
2916+ """ ,
2917+ as_dict = True ,
2918+ )
2919+ return dict (tickets = ticks )
2920+
2921+
29062922def killer ():
29072923 print (routes_onerror )
29082924 x = 5 / 0 # noqa: F841
Original file line number Diff line number Diff line change 1+ < h1 > Quick Look at Tickets</ h1 >
2+
3+ < style >
4+ pre {
5+ background-color : lightgrey;
6+ display : none;
7+ }
8+ td {
9+ font-family : monospace;
10+ border : solid black 1px ;
11+ }
12+ </ style >
13+ < table style ="width: 100% ">
14+ < colgroup >
15+ < col />
16+ < col />
17+ < col style ="width: 30% " />
18+ < col />
19+ < col />
20+ < col />
21+ < col />
22+ </ colgroup >
23+ < tr >
24+ < th > ID</ th >
25+ < th > timestamp</ th >
26+ < th > Error Message</ th >
27+ < th > Path</ th >
28+ < th > Query String</ th >
29+ < th > Hostname</ th >
30+ < th > Traceback</ th >
31+ </ tr >
32+ {{ for ticket in tickets: }}
33+ < tr >
34+ < td > {{=ticket["id"]}}</ td >
35+ < td > {{=ticket["timestamp"]}}</ td >
36+ < td > {{=ticket["err_message"]}}</ td >
37+ < td > {{=ticket["path"]}}</ td >
38+ < td > {{=ticket["query_string"]}}</ td >
39+ < td > {{=ticket["hostname"]}}</ td >
40+ < td >
41+ < a href ="# " onclick ="showtb({{=ticket['id']}}); "> Show</ a >
42+ < pre id ="{{=ticket['id']}} "> {{=ticket["traceback"]}}</ pre >
43+ </ td >
44+ </ tr >
45+ {{ pass }}
46+ </ table >
47+
48+ < h1 > Traceback for ID: < span id ="tktnum "> </ span > </ h1 >
49+ < pre id ="selectedtb "> </ pre >
50+
51+ < script >
52+ function showtb ( theel ) {
53+ let tbout = document . getElementById ( "selectedtb" ) ;
54+ let tb = document . getElementById ( theel . toString ( ) ) . innerText ;
55+ tbout . innerHTML = tb ;
56+ tbout . style . display = "block" ;
57+ let tktnum = document . getElementById ( "tktnum" ) ;
58+ tktnum . innerHTML = theel . toString ( ) ;
59+ }
60+ </ script >
You can’t perform that action at this time.
0 commit comments