Use more os.path.join

This commit is contained in:
Stefan Ritter 2010-12-14 09:52:12 +01:00
parent cbf2032d78
commit 51c4cfc7f2
1 changed files with 7 additions and 8 deletions

View File

@ -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 + "<div class=\"pages\">"
print tab*3 + "<div class=\"pages_title\">" + blog_locale[0] + "</div>"
@ -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 + "<div class=\"entry\">"
print tab*4 + "<div class=\"entry_title\">" + re.sub("^\.", "", re.sub("\d+?-", "", static_display)) + "</div>"
print tab*4 + "<div class=\"entry_content\">"
@ -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 + "</div>"
print tab*2 + "</div>"
@ -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 + "<div class=\"entry_comment\">"
print tab*5 + "<a href=\"?p=" + title.replace(" " ,"-") + "\" class=\"entry_comment\">" + blog_locale[3] + "</a>"