Switch to unified view
a/webui.py | b/webui.py | ||
---|---|---|---|
... |
... |
||
25 | 'context': 30, |
25 | 'context': 30, |
26 | 'stem': 1, |
26 | 'stem': 1, |
27 | 'timefmt': '%c', |
27 | 'timefmt': '%c', |
28 | 'dirdepth': 3, |
28 | 'dirdepth': 3, |
29 | 'maxchars': 500, |
29 | 'maxchars': 500, |
30 | 'maxresults': 100, |
||
30 | } |
31 | } |
31 | 32 | ||
32 | # sort fields/labels |
33 | # sort fields/labels |
33 | SORTS = [ |
34 | SORTS = [ |
34 | ("mtime", "Date",), |
35 | ("mtime", "Date",), |
... |
... |
||
163 | query.sortby(sort, int(ascending)) |
164 | query.sortby(sort, int(ascending)) |
164 | try: |
165 | try: |
165 | nres = query.execute(q, int(config['stem'])) |
166 | nres = query.execute(q, int(config['stem'])) |
166 | except: |
167 | except: |
167 | nres = 0 |
168 | nres = 0 |
168 | for i in range(0, nres): |
169 | for i in range(0, min(nres, int(config['maxresults']))): |
169 | doc = query.fetchone() |
170 | doc = query.fetchone() |
170 | d = {} |
171 | d = {} |
171 | for f in FIELDS: |
172 | for f in FIELDS: |
172 | d[f] = getattr(doc, f).encode('utf-8') |
173 | d[f] = getattr(doc, f).encode('utf-8') |
173 | d['label'] = select([d['title'], d['filename'], '?'], [None, '']) |
174 | d['label'] = select([d['title'], d['filename'], '?'], [None, '']) |