aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorAdrian Vondendriesch <discostu@zoozer.de>2009-07-24 16:32:33 +0200
committerAdrian Vondendriesch <discostu@zoozer.de>2009-07-24 16:32:33 +0200
commit38ce719e5ada90b6ee7ada4bed4cc567ebbeb675 (patch)
treeb09b8b919708c03e61c2f8e62aaa1a4833e5b0f9 /blogthon.cgi
parent8d585d5e7e05ab7d88661f0d5f7b4e07dd7fc522 (diff)
parentf24d0587a587dfd8c93aafa7678d2cfb7116e2f8 (diff)
Merge branch 'master' of git@fucktheforce.de:blogthon
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-xblogthon.cgi33
1 files changed, 18 insertions, 15 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 6226263..8deb211 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -189,21 +189,24 @@ if cname and ctext and ctitle:
except:
errorpage('not writable entries_dir')
comments_file = glob.glob(entries_dir + ctitle + '.comments')
- content = open(comments_file[0], "a+")
- content.write("-." + cname + "\n")
- content.write("+." + time.asctime() + "\n")
- ctext = ctext.split("\n")
- for line in ctext:
- content.write("." + line + "\n")
- content.close()
- # Send mail?
- if new_comment_mail:
- msg = 'From: Blogthon\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + re.sub(' ', '-', ctitle)
- smtp = smtplib.SMTP(smtp_host)
- if smtp_user != '' and smtp_pass != '':
- smtp.login(smtp_user, smtp_pass)
- smtp.sendmail(blog_title, mail_to, msg)
- smtp.quit()
+ try:
+ content = open(comments_file[0], "a+")
+ content.write("-." + cname + "\n")
+ content.write("+." + time.asctime() + "\n")
+ ctext = ctext.split("\n")
+ for line in ctext:
+ content.write("." + line + "\n")
+ content.close()
+ # Send mail?
+ if new_comment_mail:
+ msg = 'From: Blogthon\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + re.sub(' ', '-', ctitle)
+ smtp = smtplib.SMTP(smtp_host)
+ if smtp_user != '' and smtp_pass != '':
+ smtp.login(smtp_user, smtp_pass)
+ smtp.sendmail(blog_title, mail_to, msg)
+ smtp.quit()
+ except:
+ errorpage('commentsfile seems not to be writable!')
# Read entries and store their title and timestamp
entries = []