- 5DE963EB326E8F107264FB5D2DCEAF715B8DAFF649353295FF19BFAA560946BD856F8970C69B1B6360FB003B7548FA78302423ECF83512A4BFF43CFD3973F628
+ 5CFF8BF56C249454F81E92CBE693DD68ED16626918E9FCE4F159B1173C2C1A58CC66CF9EB4925CF7B97C969FDF834F56B0DAFD1BBDF249456C9CE610E2F238C6
logotron/reader.py
(249 . 7)(249 . 7)
23
24
25 ## Format given log line for display
26 def format_logline(l, highlights = []):
27 def format_logline(l, highlights = [], select=[]):
28 payload = html_escape(l['payload'])
29
30 # Format ordinary links:
(266 . 16)(266 . 25)
32 if l['speaker'] in Bots:
33 bot = " bot"
34
35 # default -- no selection
36 dclass = l['speaker']
37
38 # If selection is given:
39 if select != []:
40 ss, se = select
41 if ss <= l['idx'] <= se:
42 dclass = "highlight"
43
44 # HTMLize the given line :
45 s = ("<div id='{0}' class='{1}{5}'>"
46 s = ("<div id='{0}' class='{6}{5}'>"
47 "<a class='nick' title='{2}'"
48 " href=\"{3}\">{1}</a>: {4}</div>").format(l['idx'],
49 l['speaker'],
50 l['t'],
51 line_url(l),
52 payload,
53 bot)
54
55 bot,
56 dclass)
57 return s
58
59 # Make above callable from inside htm templater:
(316 . 6)(325 . 10)
61 if chan not in Channels:
62 return redirect(url_for('log'))
63
64 # Get possible selection start and end
65 sel_start = request.args.get('ss', default = 0, type = int)
66 sel_end = request.args.get('se', default = 0, type = int)
67
68 # Get current time
69 now = datetime.now()
70
(336 . 6)(349 . 10)
72 # Determine the end of the interval being shown
73 day_end = day_start + timedelta(days=1)
74
75 # Enable 'tail' is day_end is after end of current day
76 if day_end.day > now.day:
77 tail = True
78
79 # Get the loglines from DB
80 lines = query_db(
81 '''select * from loglines where chan=%s
(346 . 6)(363 . 7)
83 return render_template('log.html',
84 chan = chan,
85 loglines = lines,
86 sel = (sel_start, sel_end),
87 date = date,
88 tail = tail)
89
(403 . 8)(421 . 6)
91 tokens_formed,
92 Max_Search_Results], one=False)
93 else:
94 print "from=", from_users
95
96 searchres = query_db(
97 '''select * from loglines where chan=%s
98 and speaker ilike any(%s)