Merge branch 'master' of git@fucktheforce.de:blogthon

This commit is contained in:
Adrian Vondendriesch 2009-07-24 16:32:33 +02:00
commit 38ce719e5a
1 changed files with 18 additions and 15 deletions

View File

@ -189,21 +189,24 @@ if cname and ctext and ctitle:
except: except:
errorpage('not writable entries_dir') 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+") try:
content.write("-." + cname + "\n") content = open(comments_file[0], "a+")
content.write("+." + time.asctime() + "\n") content.write("-." + cname + "\n")
ctext = ctext.split("\n") content.write("+." + time.asctime() + "\n")
for line in ctext: ctext = ctext.split("\n")
content.write("." + line + "\n") for line in ctext:
content.close() content.write("." + line + "\n")
# Send mail? content.close()
if new_comment_mail: # Send mail?
msg = 'From: Blogthon\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + re.sub(' ', '-', ctitle) if new_comment_mail:
smtp = smtplib.SMTP(smtp_host) msg = 'From: Blogthon\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + re.sub(' ', '-', ctitle)
if smtp_user != '' and smtp_pass != '': smtp = smtplib.SMTP(smtp_host)
smtp.login(smtp_user, smtp_pass) if smtp_user != '' and smtp_pass != '':
smtp.sendmail(blog_title, mail_to, msg) smtp.login(smtp_user, smtp_pass)
smtp.quit() 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 # Read entries and store their title and timestamp
entries = [] entries = []