fix path issue

This commit is contained in:
Ville Rantanen
2015-06-25 10:06:48 +03:00
parent fe5ac26e53
commit 86f3f09359

View File

@@ -43,8 +43,8 @@ def generate_index(opts):
f.write(get_header(opts.title))
if opts.parent:
f.write(get_pathlink('..'))
for pa in dirs:
f.write(get_pathlink(pa))
for di in dirs:
f.write(get_pathlink(path,di))
for fi in files:
f.write(get_filelink(path,fi))
f.write(get_footer())
@@ -58,10 +58,10 @@ def get_filelink(path,fname):
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
return '<tr><td><a href="'+urllib.quote(fname)+'">'+fname+'</a><td class="right">'+fsstr+'</td><td class="right">'+fdstr+'</td></tr>\n'
def get_pathlink(path):
fdate=time.localtime(os.path.getmtime(path))
def get_pathlink(path,dname):
fdate=time.localtime(os.path.getmtime(os.path.join(path,dname)))
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
return '<tr><td><a href="'+urllib.quote(path)+'">'+path+'</a><td class="right">[DIR]</td><td class="right">'+fdstr+'</td></tr>\n'
return '<tr><td><a href="'+urllib.quote(dname)+'">'+dname+'</a><td class="right">[DIR]</td><td class="right">'+fdstr+'</td></tr>\n'
def get_header(title):
header='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">