Added exception for non-writable entries_dir

This commit is contained in:
Adrian Vondendriesch 2009-06-01 03:45:21 +02:00
parent 76e671fcfe
commit a1cf3893a9

View File

@ -38,6 +38,8 @@ def errorpage(string):
print ' Directory <b>"' + staticpages_dir + '"</b> does not exist!' print ' Directory <b>"' + staticpages_dir + '"</b> does not exist!'
elif string == "linklist": elif string == "linklist":
print ' File <b>"linklist"</b> does not exist!' print ' File <b>"linklist"</b> does not exist!'
elif string =="not writable entries_dir":
print ' Admin is a dumbass!!! Tell him to make his entries_dir writable.'
else: else:
print ' <b>' + string + '</b> is not set in configuration, please check your installation!' print ' <b>' + string + '</b> is not set in configuration, please check your installation!'
print '</body>' print '</body>'
@ -155,8 +157,11 @@ if cname and ctext and ctitle:
else: else:
comments_file = glob.glob(entries_dir + ctitle + '.comments') comments_file = glob.glob(entries_dir + ctitle + '.comments')
if not comments_file: if not comments_file:
try:
content = open(entries_dir + ctitle + '.comments', "w") content = open(entries_dir + ctitle + '.comments', "w")
content.close() content.close()
except:
errorpage('not writable entries_dir')
comments_file = glob.glob(entries_dir + ctitle + '.comments') 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")