From 2fb6e1483d8cb60d3139d7728949d061555e8a11 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Wed, 2 Dec 2009 14:12:05 +0100 Subject: Code cleanup and bugfix --- blogthon.cgi | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index 8f7c11e..3ff5dab 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -121,12 +121,10 @@ action = cgi.FieldStorage() month_display = action.getvalue('m') static_display = action.getvalue('s') -if static_display: static_display = re.sub('/', '', static_display) +if static_display: static_display = static_display.replace('/', '') post_display = action.getvalue('p') -if post_display: - post_display = post_display.replace(' ', '-') \ - .replace('/', '') +if post_display: post_display = post_display.replace(' ', '-').replace('/', '') allentries_display = action.getvalue('a') feed_display = action.getvalue('feed') @@ -151,12 +149,8 @@ if not cquizv: cquizv = "" # Comment to commit? if cname and ctext and ctitle: # Prevent XSS hacks - cname = cname.replace('<', '<') \ - .replace('>', '>') \ - .replace('\'', '"') - ctext = ctext.replace('<', '<') \ - .replace('>', '>') \ - .replace('\'', '"') + cname = cname.replace('<', '<').replace('>', '>').replace('\'', '"') + ctext = ctext.replace('<', '<').replace('>', '>').replace('\'', '"') # Add comment if not cquiz == cquizv: @@ -179,7 +173,7 @@ if cname and ctext and ctitle: content.close() # Send mail? if new_comment_mail: - msg = 'From: Blogthon\nTo: ' + mail_to + '\nSubject: New comment on ' + blog_title + '\n\nSomeone wrote a comment to this entry: ' + blog_url + '?p=' + re.sub(' ', '-', ctitle) + 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() @@ -396,12 +390,12 @@ else: title = title.replace('.' + entries_suffix, '') if month_display == date_to_compare or not month_display: - if post_display == post_display.replace(' ', '-') or not post_display: + if post_display == title.replace(' ', '-') or not post_display: if allentries_display == "1" or entry_counter < entries_per_page: content = open(entry, "r") print '
' if permalinks: - print '
' + title + '
' + print '
' + title + '
' else: print '
' + title + '
' print ' ' -- cgit v1.2.3