From 51c4cfc7f24efe95e2300b042db71a8a575c6ece Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Tue, 14 Dec 2010 09:52:12 +0100 Subject: Use more os.path.join --- blogthon.cgi | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index eef2d92..325903c 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -240,11 +240,11 @@ if cname and ctext and ctitle: # Read entries and store their title and timestamp entries = [] -entries_list = glob(entries_dir + "*." + entries_suffix) +entries_list = glob(os.path.join(entries_dir, "*." + entries_suffix)) for entry in entries_list: - title = entry.replace(entries_dir, "", 1) - title = title.replace("." + entries_suffix, "") + title = entry.replace(entries_dir, "", 1) + title = title.replace("." + entries_suffix, "") stampfile = os.path.join(entries_dir, title + ".stamp") if os.path.exists(stampfile): @@ -384,7 +384,7 @@ else: # Staticpages if staticpages == "True": staticpages = [] - staticpages_list = glob(staticpages_dir + "*") + staticpages_list = glob(os.path.join(staticpages_dir, "*")) staticpages_list.sort() print tab*2 + "
" print tab*3 + "
" + blog_locale[0] + "
" @@ -453,7 +453,7 @@ else: # Staticpage if static_display != "": - content = open(staticpages_dir + static_display, "r") + content = open(os.path.join(staticpages_dir, static_display), "r") print tab*3 + "
" print tab*4 + "
" + re.sub("^\.", "", re.sub("\d+?-", "", static_display)) + "
" print tab*4 + "
" @@ -514,10 +514,9 @@ else: # Comments... # ... are shown when post_display and comments_file isn't false - comments_file = glob(entries_dir + title + ".comments") + comments_file = glob(os.path.join(entries_dir, title + ".comments")) if post_display: if comments_file: - comments_file = glob(entries_dir + title + ".comments") comments_content = open(comments_file[0], "r") print tab*3 + "
" print tab*2 + "
" @@ -576,7 +575,7 @@ else: print "" if comments == "True": - comments_file = glob(entries_dir + title + ".comments") + comments_file = glob(os.path.join(entries_dir, title + ".comments")) if not comments_file and not post_display: print tab*4 + "
" print tab*5 + "" + blog_locale[3] + "" -- cgit v1.2.3