/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/medium.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-01 00:36:13 UTC
  • mfrom: (2692.1.26 bug-124089)
  • Revision ID: pqm@pqm.ubuntu.com-20080401003613-w51tu4gd3yqogm8s
Add root_client_path parameter to SmartWSGIApp and
        SmartServerRequest. (Andrew Bennetts, #124089)

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    which will typically be a LocalTransport looking at the server's filesystem.
56
56
    """
57
57
 
58
 
    def __init__(self, backing_transport):
 
58
    def __init__(self, backing_transport, root_client_path='/'):
59
59
        """Construct new server.
60
60
 
61
61
        :param backing_transport: Transport for the directory served.
62
62
        """
63
63
        # backing_transport could be passed to serve instead of __init__
64
64
        self.backing_transport = backing_transport
 
65
        self.root_client_path = root_client_path
65
66
        self.finished = False
66
67
 
67
68
    def serve(self):
93
94
            bytes = bytes[len(REQUEST_VERSION_TWO):]
94
95
        else:
95
96
            protocol_class = SmartServerRequestProtocolOne
96
 
        protocol = protocol_class(self.backing_transport, self._write_out)
 
97
        protocol = protocol_class(
 
98
            self.backing_transport, self._write_out, self.root_client_path)
97
99
        protocol.accept_bytes(bytes)
98
100
        return protocol
99
101
 
141
143
 
142
144
class SmartServerSocketStreamMedium(SmartServerStreamMedium):
143
145
 
144
 
    def __init__(self, sock, backing_transport):
 
146
    def __init__(self, sock, backing_transport, root_client_path='/'):
145
147
        """Constructor.
146
148
 
147
149
        :param sock: the socket the server will read from.  It will be put
148
150
            into blocking mode.
149
151
        """
150
 
        SmartServerStreamMedium.__init__(self, backing_transport)
 
152
        SmartServerStreamMedium.__init__(
 
153
            self, backing_transport, root_client_path=root_client_path)
151
154
        self.push_back = ''
152
155
        sock.setblocking(True)
153
156
        self.socket = sock