Merge pull request #247 from pylast/use-named-version-attributes
Simplify version checking
This commit is contained in:
commit
adea26ec4c
1 changed files with 8 additions and 9 deletions
|
@ -39,17 +39,16 @@ __license__ = "apache2"
|
||||||
__email__ = 'amr.hassan@gmail.com'
|
__email__ = 'amr.hassan@gmail.com'
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info.major == 2:
|
||||||
import html.entities as htmlentitydefs
|
|
||||||
from http.client import HTTPSConnection
|
|
||||||
from urllib.parse import quote_plus as url_quote_plus
|
|
||||||
|
|
||||||
unichr = chr
|
|
||||||
|
|
||||||
elif sys.version_info[0] == 2:
|
|
||||||
import htmlentitydefs
|
import htmlentitydefs
|
||||||
from httplib import HTTPSConnection
|
from httplib import HTTPSConnection
|
||||||
from urllib import quote_plus as url_quote_plus
|
from urllib import quote_plus as url_quote_plus
|
||||||
|
else:
|
||||||
|
import html.entities as htmlentitydefs
|
||||||
|
from http.client import HTTPSConnection
|
||||||
|
from urllib.parse import quote_plus as url_quote_plus
|
||||||
|
unichr = chr
|
||||||
|
|
||||||
|
|
||||||
STATUS_INVALID_SERVICE = 2
|
STATUS_INVALID_SERVICE = 2
|
||||||
STATUS_INVALID_METHOD = 3
|
STATUS_INVALID_METHOD = 3
|
||||||
|
@ -2608,7 +2607,7 @@ def _string(string):
|
||||||
if isinstance(string, str):
|
if isinstance(string, str):
|
||||||
return string
|
return string
|
||||||
casted = six.text_type(string)
|
casted = six.text_type(string)
|
||||||
if sys.version_info[0] == 2:
|
if sys.version_info.major == 2:
|
||||||
casted = casted.encode("utf-8")
|
casted = casted.encode("utf-8")
|
||||||
return casted
|
return casted
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue