aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2011-03-24 13:05:22 +0100
committerStefan Ritter <xeno@thehappy.de>2011-03-24 13:05:22 +0100
commit7b67581d1195583db5e2955247c6db7c75bdbdb3 (patch)
tree315807b7226f3d65a52860b5e67d72cc493512ba /blogthon.cgi
parent718bb41ff5ab7237cbe141e34925140ea5dd74dc (diff)
Import (ConfigParser|configparser) as configparser
Diffstat (limited to '')
-rwxr-xr-xblogthon.cgi14
1 files changed, 4 insertions, 10 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index b1777b0..d7730ee 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -21,9 +21,9 @@ import re
# Backward compatibilty to python2
try:
- import configparser
-except:
- import ConfigParser
+ import configparser as configparser
+except ImportError:
+ import ConfigParser as configparser
from cgi import FieldStorage
from smtplib import SMTP
@@ -77,10 +77,7 @@ def document_header(string):
print("<rss version=\"2.0\">")
# Parse configuration (with backward compatibilty)
-try:
- configuration = configparser.SafeConfigParser()
-except:
- configuration = ConfigParser.SafeConfigParser()
+configuration = configparser.SafeConfigParser()
for config in ["../blogthonrc", "../.blogthonrc", "configuration"]:
if os.path.exists(config):
@@ -117,9 +114,6 @@ try:
feed_preview = configuration.get("feed", "feed_preview")
except configparser.Error as error:
errorpage(str(error))
-# And for backward compatibility
-except ConfigParser.Error as error:
- errorpage(str(error))
if not re.match("^http:\/\/.*$", blog_url):
blog_url = "http://" + blog_url