Fixed send-comment function (now works with apache)
This commit is contained in:
parent
ecd758e7f1
commit
6ff2c622be
@ -190,9 +190,9 @@ if cname and ctext and ctitle:
|
||||
content = open(entries_dir + ctitle + '.comments', "w")
|
||||
content.close()
|
||||
except:
|
||||
errorpage(entries_dir, 'isn\'t writable!')
|
||||
errorpage('"' + entries_dir + '" isn\'t writable!')
|
||||
try:
|
||||
content = open(comments_file[0], "a+")
|
||||
content = open(entries_dir + ctitle + '.comments', "a")
|
||||
content.write("-." + cname + "\n")
|
||||
content.write("+." + time.asctime() + "\n")
|
||||
ctext = ctext.split("\n")
|
||||
@ -200,13 +200,13 @@ if cname and ctext and ctitle:
|
||||
content.write("." + line + "\n")
|
||||
content.close()
|
||||
# Send mail?
|
||||
if new_comment_mail:
|
||||
if not new_comment_mail == 'False':
|
||||
msg = 'From: Blogthon\nTo: ' + mail_to + '\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + ctitle.replace(' ', '-')
|
||||
smtp = smtplib.SMTP(smtp_host)
|
||||
smtp.sendmail(blog_title, mail_to, msg)
|
||||
smtp.quit()
|
||||
except:
|
||||
errorpage(comments_file, 'isn\'t writable!')
|
||||
errorpage('Comment cannot be written!')
|
||||
|
||||
# Read entries and store their title and timestamp
|
||||
entries = []
|
||||
|
Loading…
Reference in New Issue
Block a user