From 6819b57353cd7d2f7f7b2b31fb849f1c0a566f00 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 6 Jul 2012 11:05:47 -0700 Subject: Handle converting None to byte data (b''). --- sleekxmpp/thirdparty/suelta/util.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sleekxmpp/thirdparty') diff --git a/sleekxmpp/thirdparty/suelta/util.py b/sleekxmpp/thirdparty/suelta/util.py index 7d822a81..cd2439d5 100644 --- a/sleekxmpp/thirdparty/suelta/util.py +++ b/sleekxmpp/thirdparty/suelta/util.py @@ -15,6 +15,9 @@ def bytes(text): :param text: Unicode text to convert to bytes :rtype: bytes (Python3), str (Python2.6+) """ + if text is None: + return b'' + if sys.version_info < (3, 0): import __builtin__ return __builtin__.bytes(text) -- cgit v1.2.3