Show More
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | import logging |
|
2 | 2 | import sys |
|
3 | 3 | import time |
|
4 |
from |
|
|
4 | from io import StringIO | |
|
5 | 5 | |
|
6 | 6 | from session import extract_header, Message |
|
7 | 7 | |
@@ -45,10 +45,6 b' class OutStream(object):' | |||
|
45 | 45 | else: |
|
46 | 46 | data = self._buffer.getvalue() |
|
47 | 47 | if data: |
|
48 | # Make sure that we're handling unicode | |
|
49 | if not isinstance(data, unicode): | |
|
50 | enc = sys.stdin.encoding or sys.getdefaultencoding() | |
|
51 | data = data.decode(enc, 'replace') | |
|
52 | 48 | content = {u'name':self.name, u'data':data} |
|
53 | 49 | msg = self.session.send(self.pub_socket, u'stream', content=content, |
|
54 | 50 | parent=self.parent_header, ident=self.topic) |
@@ -73,11 +69,11 b' class OutStream(object):' | |||
|
73 | 69 | if self.pub_socket is None: |
|
74 | 70 | raise ValueError('I/O operation on closed file') |
|
75 | 71 | else: |
|
76 | # We can only send raw bytes, not unicode objects, so we encode | |
|
77 | # into utf-8 for all frontends if we get unicode inputs. | |
|
78 | if type(string) == unicode: | |
|
79 |
string = string.e |
|
|
80 |
|
|
|
72 | # Make sure that we're handling unicode | |
|
73 | if not isinstance(string, unicode): | |
|
74 | enc = sys.stdin.encoding or sys.getdefaultencoding() | |
|
75 | string = string.decode(enc, 'replace') | |
|
76 | ||
|
81 | 77 | self._buffer.write(string) |
|
82 | 78 | current_time = time.time() |
|
83 | 79 | if self._start <= 0: |
General Comments 0
You need to be logged in to leave comments.
Login now