Skip to content

Commit 9d74bc5

Browse files
authored
Merge pull request #221 from Klupamos/master
Fix for issue #218
2 parents 46899a5 + 49b4550 commit 9d74bc5

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

pdfkit/pdfkit.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
from .configuration import Configuration
88
import io
99
import codecs
10-
try:
11-
# Python 2.x and 3.x support for checking string types
12-
basestring
13-
unicode
14-
except NameError:
15-
basestring = str
16-
unicode = str
10+
11+
# Python 2.x and 3.x support for checking string types
12+
basestring = str.__mro__[-2]
13+
unicode = type(u'')
1714

1815

1916
class PDFKit(object):

pdfkit/source.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# -*- coding: utf-8 -*-
22
import os
33
import io
4-
try:
5-
# Python 2.x and 3.x support for checking string types
6-
assert basestring
7-
assert unicode
8-
except NameError:
9-
basestring = str
10-
unicode = str
114

5+
# Python 2.x and 3.x support for checking string types
6+
basestring = str.__mro__[-2]
7+
unicode = type(u'')
128

139

1410
class Source(object):

0 commit comments

Comments
 (0)