/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/message.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from __future__ import absolute_import
18
18
 
19
19
import collections
 
20
from cStringIO import StringIO
20
21
 
21
 
from ... import (
 
22
from bzrlib import (
22
23
    debug,
23
24
    errors,
24
25
    )
25
 
from ...sixish import (
26
 
    BytesIO,
27
 
    )
28
 
from ...trace import mutter
 
26
from bzrlib.trace import mutter
29
27
 
30
28
 
31
29
class MessageHandler(object):
247
245
        self._bytes_parts.append(bytes)
248
246
 
249
247
    def structure_part_received(self, structure):
250
 
        if not isinstance(structure, tuple):
 
248
        if type(structure) is not tuple:
251
249
            raise errors.SmartProtocolError(
252
250
                'Args structure is not a sequence: %r' % (structure,))
253
251
        if not self._body_started:
326
324
            body_bytes = ''.join(self._bytes_parts)
327
325
            if 'hpss' in debug.debug_flags:
328
326
                mutter('              %d body bytes read', len(body_bytes))
329
 
            self._body = BytesIO(body_bytes)
 
327
            self._body = StringIO(body_bytes)
330
328
            self._bytes_parts = None
331
329
        return self._body.read(count)
332
330
 
348
346
def _raise_smart_server_error(error_tuple):
349
347
    """Raise exception based on tuple received from smart server
350
348
 
351
 
    Specific error translation is handled by breezy.bzr.remote._translate_error
 
349
    Specific error translation is handled by bzrlib.remote._translate_error
352
350
    """
353
351
    if error_tuple[0] == 'UnknownMethod':
354
352
        raise errors.UnknownSmartMethod(error_tuple[1])