diff options
author | Nathan Fritz <fritzy@netflint.net> | 2010-01-25 10:40:44 -0800 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2010-01-25 10:40:44 -0800 |
commit | 6e4c1128ec8f01d31c7714c13db02ff20c7a0a40 (patch) | |
tree | ed4106411254e5682f7435a8c970a22d8e324d63 /sleekxmpp/xmlstream/xmlstream.py | |
parent | 6e1aa0690f4c2bcc1031aed05305ef84f36fbb57 (diff) | |
download | slixmpp-6e4c1128ec8f01d31c7714c13db02ff20c7a0a40.tar.gz slixmpp-6e4c1128ec8f01d31c7714c13db02ff20c7a0a40.tar.bz2 slixmpp-6e4c1128ec8f01d31c7714c13db02ff20c7a0a40.tar.xz slixmpp-6e4c1128ec8f01d31c7714c13db02ff20c7a0a40.zip |
removed stupid monkeypatch for filesocket
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 51786935..0bf8b727 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -26,7 +26,7 @@ import sys if sys.version_info < (3, 0): #monkey patch broken filesocket object from . import filesocket - socket._fileobject = filesocket.filesocket + #socket._fileobject = filesocket.filesocket class RestartStream(Exception): @@ -96,7 +96,10 @@ class XMLStream(object): if use_tls is not None: self.use_tls = use_tls self.state.set('is client', True) - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if sys.version_info < (3, 0): + self.socket = filesocket.Socket26(socket.AF_INET, socket.SOCK_STREAM) + else: + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.settimeout(None) if self.use_ssl and self.ssl_support: logging.debug("Socket Wrapped for SSL") @@ -222,10 +225,9 @@ class XMLStream(object): def sendRaw(self, data): logging.debug("SEND: %s" % data) try: - self.socket.send(bytes(data, "utf-8")) - except TypeError: - self.socket.send(bytes(data)) - #except socket.error,(errno, strerror): + self.socket.send(data.encode('utf-8')) + #self.socket.send(bytes(data, "utf-8")) + #except socket.error,(errno, strerror): except: self.state.set('connected', False) if self.state.reconnect: @@ -303,6 +305,7 @@ class XMLStream(object): try: handler.run(args[0]) except Exception as e: + traceback.print_exc() args[0].exception(e) elif etype == 'sched': try: |