aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xblogthon.cgi15
1 files changed, 7 insertions, 8 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 2457273..a8e3f3f 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -18,11 +18,16 @@ import sys
import time
import locale
import re
-import codecs
+from cgi import FieldStorage
+from smtplib import SMTP
+from hashlib import md5
+from glob import glob
+from random import randint
+from codecs import getwriter
# print() will output ascii, but we want utf-8 (python3)
try:
- sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)
+ sys.stdout = getwriter('utf8')(sys.stdout.buffer)
utf8 = True
except:
utf8 = False
@@ -33,12 +38,6 @@ try:
except ImportError:
import ConfigParser as configparser
-from cgi import FieldStorage
-from smtplib import SMTP
-from hashlib import md5
-from glob import glob
-from random import randint
-
# A wonderful place for doing some regexp ;)
no_break = re.compile("^\s*(<ul|</ul>|<li|</li>|<ol|</ol>|<table|</table>|<tr|</tr>|<td|</td>|<th|</th>|<p|</p>).*$")
line_start_hyphen = re.compile("^-.*$")