Switch to unified view

a/webui.py b/webui.py
...
...
292
    if resnum > rclq.rowcount - 1:
292
    if resnum > rclq.rowcount - 1:
293
        return 'Bad result index %d' % resnum
293
        return 'Bad result index %d' % resnum
294
    rclq.scroll(resnum)
294
    rclq.scroll(resnum)
295
    doc = rclq.fetchone()
295
    doc = rclq.fetchone()
296
    bottle.response.content_type = doc.mimetype
296
    bottle.response.content_type = doc.mimetype
297
    bottle.response.headers['Content-Disposition'] = \
298
        'attachment; filename=%s' % doc.filename
299
    # If ipath is null, we can just return the file
300
    pathismine = False
297
    pathismine = False
301
    if doc.ipath == '':
298
    if doc.ipath == '':
299
        # If ipath is null, we can just return the file
302
        path = doc.url.replace('file://','')
300
        path = doc.url.replace('file://','')
303
    else:
301
    else:
302
        # Else this is a subdocument, extract to temporary file
304
        xt = rclextract.Extractor(doc)
303
        xt = rclextract.Extractor(doc)
305
        path = xt.idoctofile(doc.ipath, doc.mimetype)
304
        path = xt.idoctofile(doc.ipath, doc.mimetype)
306
        pathismine = True
305
        pathismine = True
306
    bottle.response.headers['Content-Disposition'] = \
307
        'attachment; filename=%s' % os.path.basename(path)
307
    print >> sys.stderr, "Sending %s with mimetype %s" % (path, doc.mimetype)
308
    print >> sys.stderr, "Sending %s with mimetype %s" % (path, doc.mimetype)
308
    f = open(path, 'r')
309
    f = open(path, 'r')
309
    if pathismine:
310
    if pathismine:
310
        os.unlink(path)
311
        os.unlink(path)
311
    return f
312
    return f