aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-12-02 14:12:05 +0100
committerStefan Ritter <xeno@thehappy.de>2009-12-02 14:12:05 +0100
commit2fb6e1483d8cb60d3139d7728949d061555e8a11 (patch)
tree86f3e6d0852eb427ffcf3060fbabdc587df24364
parentaabeaf3cbc7e005f1d4084aa6cedcf79bf10568f (diff)
Code cleanup and bugfix
-rwxr-xr-xblogthon.cgi20
1 files 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('<', '&lt;') \
- .replace('>', '&gt;') \
- .replace('\'', '&quot;')
- ctext = ctext.replace('<', '&lt;') \
- .replace('>', '&gt;') \
- .replace('\'', '&quot;')
+ cname = cname.replace('<', '&lt;').replace('>', '&gt;').replace('\'', '&quot;')
+ ctext = ctext.replace('<', '&lt;').replace('>', '&gt;').replace('\'', '&quot;')
# 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 ' <div class="entry">'
if permalinks:
- print ' <div class="entry_title"><a href="?p=' + re.sub(' ', '-', title) + '" class="entry_title">' + title + '</a></div>'
+ print ' <div class="entry_title"><a href="?p=' + title.replace(' ', '-') + '" class="entry_title">' + title + '</a></div>'
else:
print ' <div class="entry_title">' + title + '</div>'
print ' <div class="entry_date">' + date + '</div>'