[PATCH 06/15] Add workaround for string.split for Python3
Nicolas Sebrecht
nicolas.s-dev at laposte.net
Tue May 10 01:27:52 BST 2016
On Tue, May 10, 2016 at 01:18:28AM +0200, Łukasz Żarnowiecki wrote:
> Signed-off-by: Łukasz Żarnowiecki <dolohow at outlook.com>
> ---
> offlineimap/imaputil.py | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py
> index 1c0b495..e2bd280 100644
> --- a/offlineimap/imaputil.py
> +++ b/offlineimap/imaputil.py
> @@ -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)
While at it, it's fine to fix spaces:
splits = string.split(workstr, maxsplit=1)
Anyway, I'll merge this one as is.
> + # 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:
> --
> 2.8.2
>
>
> _______________________________________________
> OfflineIMAP-project mailing list: OfflineIMAP-project at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>
> OfflineIMAP homepages:
> - https://github.com/OfflineIMAP
> - http://offlineimap.org
--
Nicolas Sebrecht
More information about the OfflineIMAP-project
mailing list