* Rearrange imports
* Just import getwriter from codecs
This commit is contained in:
parent
25e7cc7a09
commit
3853641e80
15
blogthon.cgi
15
blogthon.cgi
@ -18,11 +18,16 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
import re
|
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)
|
# print() will output ascii, but we want utf-8 (python3)
|
||||||
try:
|
try:
|
||||||
sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)
|
sys.stdout = getwriter('utf8')(sys.stdout.buffer)
|
||||||
utf8 = True
|
utf8 = True
|
||||||
except:
|
except:
|
||||||
utf8 = False
|
utf8 = False
|
||||||
@ -33,12 +38,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import ConfigParser as configparser
|
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 ;)
|
# 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>).*$")
|
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("^-.*$")
|
line_start_hyphen = re.compile("^-.*$")
|
||||||
|
Loading…
Reference in New Issue
Block a user