amnong / easywebdav

A WebDAV Client in Python
http://pypi.python.org/pypi/easywebdav/
ISC License
207 stars 113 forks source link

Fix missing basestring on python3 #46

Open umlaeute opened 8 years ago

umlaeute commented 8 years ago

python3 lacks the 'basestring' class, instead all strings are unicode and of type 'str'. this patch makes easywebdav py3-able

afsneto commented 6 years ago

Just insert at the beginning of the code (after import statements):

try:
    unicode = unicode
except NameError:
    # 'unicode' is undefined, must be Python 3
    str = str
    unicode = str
    bytes = bytes
    basestring = (str,bytes)
else:
    # 'unicode' exists, must be Python 2
    str = str
    unicode = unicode
    bytes = str
    basestring = basestring