/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/transport/smart.py

Add readonly support to the smart server, enabled by default via `bzr server`.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
"""
50
50
 
51
51
 
 
52
# TODO: _translate_error should be on the client, not the transport because
 
53
#     error coding is wire protocol specific.
52
54
 
53
55
# TODO: A plain integer from query_version is too simple; should give some
54
56
# capabilities too?
465
467
            # This handles UnicodeEncodeError or UnicodeDecodeError
466
468
            return SmartServerResponse((e.__class__.__name__,
467
469
                    e.encoding, val, str(e.start), str(e.end), e.reason))
 
470
        except errors.TransportNotPossible, e:
 
471
            if e.msg == "readonly transport":
 
472
                return SmartServerResponse(('ReadOnlyError', ))
 
473
            else:
 
474
                raise
468
475
 
469
476
 
470
477
class SmartTCPServer(object):
861
868
                raise UnicodeDecodeError(encoding, val, start, end, reason)
862
869
            elif what == 'UnicodeEncodeError':
863
870
                raise UnicodeEncodeError(encoding, val, start, end, reason)
 
871
        elif what == "ReadOnlyError":
 
872
            raise errors.TransportNotPossible('readonly transport')
864
873
        else:
865
874
            raise errors.SmartProtocolError('unexpected smart server error: %r' % (resp,))
866
875