~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

remove all trailing whitespace from bzr source

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
class SmartServerRequest(object):
45
45
    """Base class for request handlers.
46
 
    
 
46
 
47
47
    To define a new request, subclass this class and override the `do` method
48
48
    (and if appropriate, `do_body` as well).  Request implementors should take
49
49
    care to call `translate_client_path` and `transport_from_client_path` as
77
77
 
78
78
    def do(self, *args):
79
79
        """Mandatory extension point for SmartServerRequest subclasses.
80
 
        
 
80
 
81
81
        Subclasses must implement this.
82
 
        
 
82
 
83
83
        This should return a SmartServerResponse if this command expects to
84
84
        receive no body.
85
85
        """
100
100
        """Called if the client sends a body with the request.
101
101
 
102
102
        The do() method is still called, and must have returned None.
103
 
        
 
103
 
104
104
        Must return a SmartServerResponse.
105
105
        """
106
106
        raise NotImplementedError(self.do_body)
115
115
    def do_end(self):
116
116
        """Called when the end of the request has been received."""
117
117
        pass
118
 
    
 
118
 
119
119
    def translate_client_path(self, client_path):
120
120
        """Translate a path received from a network client into a local
121
121
        relpath.
154
154
 
155
155
class SmartServerResponse(object):
156
156
    """A response to a client request.
157
 
    
 
157
 
158
158
    This base class should not be used. Instead use
159
159
    SuccessfulSmartServerResponse and FailedSmartServerResponse as appropriate.
160
160
    """
204
204
 
205
205
class SmartServerRequestHandler(object):
206
206
    """Protocol logic for smart server.
207
 
    
 
207
 
208
208
    This doesn't handle serialization at all, it just processes requests and
209
209
    creates responses.
210
210
    """
244
244
 
245
245
        # default fallback is to accumulate bytes.
246
246
        self._body_bytes += bytes
247
 
        
 
247
 
248
248
    def end_of_body(self):
249
249
        """No more body data will be received."""
250
250
        self._run_handler_code(self._command.do_body, (self._body_bytes,), {})