--- a/views/result.tpl
+++ b/views/result.tpl
@@ -2,12 +2,12 @@
<div class="search-result">
%number = (query['page'] - 1)*config['perpage'] + i + 1
<div class="search-result-number"><a href="#r{{d['sha']}}">#{{number}}</a></div>
- %url = d['url'].replace('file://', '')
+ %url = d['url'].replace(b'file://', b'')
%for dr, prefix in config['mounts'].items():
- %url = url.replace(dr, prefix)
+ %url = url.replace(dr.encode('utf-8'), prefix.encode('utf-8'))
%end
<div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}">
- %if config.has_key('title_link') and config['title_link'] != 'download':
+ %if 'title_link' in config and config['title_link'] != 'download':
%if config['title_link'] == 'open':
<a href="{{url}}">{{d['label']}}</a>
%elif config['title_link'] == 'preview':
@@ -20,13 +20,13 @@
%if len(d['ipath']) > 0:
<div class="search-result-ipath">[{{d['ipath']}}]</div>
%end
- %if d.has_key('author') and len(d['author']) > 0:
+ %if 'author' in d and len(d['author']) > 0:
<div class="search-result-author">{{d['author']}}</div>
%end
<div class="search-result-url">
- %urllabel = os.path.dirname(d['url'].replace('file://', ''))
+ %urllabel = os.path.dirname(d['url'].replace(b'file://', b''))
%for r in config['dirs']:
- %urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
+ %urllabel = urllabel.replace(r.encode('utf-8').rsplit(b'/',1)[0] + b'/' , b'')
%end
<a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
</div>