Use more os.path.join

This commit is contained in:
Stefan Ritter 2010-12-14 09:52:12 +01:00
parent cbf2032d78
commit 51c4cfc7f2

View File

@ -240,7 +240,7 @@ if cname and ctext and ctitle:
# Read entries and store their title and timestamp # Read entries and store their title and timestamp
entries = [] entries = []
entries_list = glob(entries_dir + "*." + entries_suffix) entries_list = glob(os.path.join(entries_dir, "*." + entries_suffix))
for entry in entries_list: for entry in entries_list:
title = entry.replace(entries_dir, "", 1) title = entry.replace(entries_dir, "", 1)
@ -384,7 +384,7 @@ else:
# Staticpages # Staticpages
if staticpages == "True": if staticpages == "True":
staticpages = [] staticpages = []
staticpages_list = glob(staticpages_dir + "*") staticpages_list = glob(os.path.join(staticpages_dir, "*"))
staticpages_list.sort() staticpages_list.sort()
print tab*2 + "<div class=\"pages\">" print tab*2 + "<div class=\"pages\">"
print tab*3 + "<div class=\"pages_title\">" + blog_locale[0] + "</div>" print tab*3 + "<div class=\"pages_title\">" + blog_locale[0] + "</div>"
@ -453,7 +453,7 @@ else:
# Staticpage # Staticpage
if static_display != "": 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*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_title\">" + re.sub("^\.", "", re.sub("\d+?-", "", static_display)) + "</div>"
print tab*4 + "<div class=\"entry_content\">" print tab*4 + "<div class=\"entry_content\">"
@ -514,10 +514,9 @@ else:
# Comments... # Comments...
# ... are shown when post_display and comments_file isn't false # ... 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 post_display:
if comments_file: if comments_file:
comments_file = glob(entries_dir + title + ".comments")
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")
print tab*3 + "</div>" print tab*3 + "</div>"
print tab*2 + "</div>" print tab*2 + "</div>"
@ -576,7 +575,7 @@ else:
print "" print ""
if comments == "True": 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: if not comments_file and not post_display:
print tab*4 + "<div class=\"entry_comment\">" print tab*4 + "<div class=\"entry_comment\">"
print tab*5 + "<a href=\"?p=" + title.replace(" " ,"-") + "\" class=\"entry_comment\">" + blog_locale[3] + "</a>" print tab*5 + "<a href=\"?p=" + title.replace(" " ,"-") + "\" class=\"entry_comment\">" + blog_locale[3] + "</a>"