Commit 51aa2f67 authored by koniu's avatar koniu
Browse files

Merge pull request #31 from medoc92/master

Remove some wrong assumptions about the  filename and fmtime fields
parents 788061bd 59bc9e14
%import shlex, unicodedata
%import shlex, unicodedata, os
<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>
......@@ -14,11 +14,11 @@
<div class="search-result-author">{{d['author']}}</div>
%end
<div class="search-result-url">
%urllabel = d['url'].replace('/'+d['filename'],'').replace('file://','')
%urllabel = os.path.dirname(d['url'].replace('file://', ''))
%for r in config['dirs']:
%urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
%end
<a href="{{url.replace('/'+d['filename'],'')}}">{{urllabel}}</a>
<a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
</div>
%if hasrclextract:
<div class="search-result-links">
......
......@@ -84,6 +84,8 @@ def select(ls, invalid=[None]):
return value
def timestr(secs, fmt):
if secs == '' or secs is None:
secs = '0'
t = time.gmtime(int(secs))
return time.strftime(fmt, t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment