Skip to content

Commit 2ba1b9e

Browse files
committed
let's get some more python3 compatible imports going
1 parent 096f146 commit 2ba1b9e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

publisher/tempita/__init__.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,17 @@ def foo(bar):
3333
import re
3434
import sys
3535
import cgi
36-
from urllib import quote as url_quote
36+
3737
import os
3838
import tokenize
39-
from cStringIO import StringIO
39+
40+
try:
41+
from urllib import quote as url_quote
42+
from cStringIO import StringIO
43+
except ImportError:
44+
from urllib.parse import quote as url_quote
45+
from io import StringIO
46+
4047
from tempita._looper import looper
4148
from tempita.compat3 import bytes, basestring_, next, is_unicode, coerce_text
4249

0 commit comments

Comments
 (0)