Comments:

* Fixed a bug when the commentsfile is not existing
This commit is contained in:
Stefan Ritter 2009-03-08 19:39:52 +01:00
parent 6b30c4447e
commit eb925c9037
1 changed files with 19 additions and 14 deletions

View File

@ -63,6 +63,10 @@ if cname and ctext and ctitle:
# Add comment # Add comment
comments_file = glob.glob(entries_dir + ctitle + '.comments') comments_file = glob.glob(entries_dir + ctitle + '.comments')
if not comments_file:
content = open(entries_dir + ctitle + '.comments', "w")
content.close()
comments_file = glob.glob(entries_dir + ctitle + '.comments')
content = open(comments_file[0], "a+") content = open(comments_file[0], "a+")
content.write("-." + cname + "\n") content.write("-." + cname + "\n")
content.write("+." + time.asctime() + "\n") content.write("+." + time.asctime() + "\n")
@ -168,7 +172,8 @@ else: # Show regular entry
# Comments are shown when post_display and comments_file # Comments are shown when post_display and comments_file
comments_file = glob.glob(entries_dir + title + '.comments') comments_file = glob.glob(entries_dir + title + '.comments')
if comments_file and post_display: if post_display:
if comments_file:
print ' <br /><hr>' print ' <br /><hr>'
comments_file = glob.glob(entries_dir + title + '.comments') comments_file = glob.glob(entries_dir + title + '.comments')
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")