From 86f3f093599a57b8f1c3b2af05f2474a3616974b Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Thu, 25 Jun 2015 10:06:48 +0300 Subject: [PATCH] fix path issue --- web_serving/SimpleWebPage.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_serving/SimpleWebPage.py b/web_serving/SimpleWebPage.py index 19b3581..d863440 100755 --- a/web_serving/SimpleWebPage.py +++ b/web_serving/SimpleWebPage.py @@ -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 ''+fname+''+fsstr+''+fdstr+'\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 ''+path+'[DIR]'+fdstr+'\n' + return ''+dname+'[DIR]'+fdstr+'\n' def get_header(title): header='''