Switch to unified view

a/webui.py b/webui.py
...
...
309
        return 'Bad result index %d' % resnum
309
        return 'Bad result index %d' % resnum
310
    rclq.scroll(resnum)
310
    rclq.scroll(resnum)
311
    doc = rclq.fetchone()
311
    doc = rclq.fetchone()
312
    bottle.response.content_type = doc.mimetype
312
    bottle.response.content_type = doc.mimetype
313
    pathismine = False
313
    pathismine = False
314
    if doc.ipath == '':
314
315
        # If ipath is null, we can just return the file
316
        path = doc.url.replace('file://','')
317
    else:
318
        # Else this is a subdocument, extract to temporary file
319
        xt = rclextract.Extractor(doc)
315
    xt = rclextract.Extractor(doc)
320
        path = xt.idoctofile(doc.ipath, doc.mimetype)
316
    path = xt.idoctofile(doc.ipath, doc.mimetype)
321
        pathismine = True
317
    pathismine = True
318
322
    bottle.response.headers['Content-Disposition'] = \
319
    bottle.response.headers['Content-Disposition'] = \
323
        'attachment; filename="%s"' % os.path.basename(path).encode('utf-8')
320
        'attachment; filename="%s"' % os.path.basename(path).encode('utf-8')
324
    path = path.encode('utf-8')
321
    path = path.encode('utf-8')
325
    bottle.response.headers['Content-Length'] = os.stat(path).st_size
322
    bottle.response.headers['Content-Length'] = os.stat(path).st_size
326
    f = open(path, 'r')
323
    f = open(path, 'r')