/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 breezy/bzr/smart/request.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
      of times during a request).
27
27
"""
28
28
 
 
29
from __future__ import absolute_import
 
30
 
29
31
# XXX: The class names are a little confusing: the protocol will instantiate a
30
32
# SmartServerRequestHandler, whose dispatch_command method creates an instance
31
33
# of a SmartServerRequest subclass.
32
34
 
33
35
 
34
36
import threading
35
 
from _thread import get_ident
 
37
try:
 
38
    from _thread import get_ident
 
39
except ImportError:  # Python < 3
 
40
    from thread import get_ident
36
41
 
37
42
from ... import (
38
43
    branch as _mod_branch,
44
49
    trace,
45
50
    urlutils,
46
51
    )
 
52
from ...sixish import text_type
47
53
from ...lazy_import import lazy_import
48
54
lazy_import(globals(), """
49
55
from breezy.bzr import bzrdir
443
449
        # If it is a DecodeError, than most likely we are starting
444
450
        # with a plain string
445
451
        str_or_unicode = err.object
446
 
        if isinstance(str_or_unicode, str):
 
452
        if isinstance(str_or_unicode, text_type):
447
453
            # XXX: UTF-8 might have \x01 (our protocol v1 and v2 seperator
448
454
            # byte) in it, so this encoding could cause broken responses.
449
455
            # Newer clients use protocol v3, so will be fine.