Add workaround for string.split for Python3

Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Łukasz Żarnowiecki 2016-05-08 15:51:59 +02:00 committed by Nicolas Sebrecht
parent 4fbb5640ac
commit 3848bc55f3
1 changed files with 7 additions and 1 deletions

View File

@ -161,7 +161,13 @@ def imapsplit(imapstring):
retval.append(quoted)
workstr = rest
else:
splits = string.split(workstr, maxsplit = 1)
splits = None
# Python2
if hasattr(string, 'split'):
splits = string.split(workstr, maxsplit = 1)
# Python3
else:
splits = str.split(workstr, maxsplit = 1)
splitslen = len(splits)
# The unquoted word is splits[0]; the remainder is splits[1]
if splitslen == 2: