Пример #1
0
    def process_request(self, start_response, environ):
        connection = make_server_connection(start_response, environ,
            connection_protocol=self.connection_protocol)
        try:
            data = connection.load_request()
            if len(data) == 2:
                command, params = data
                keyword_params = {}
            elif len(data) == 3:
                command, params, keyword_params = data
            else:
                return connection.ERROR(['connection.load_request() returned malformed data'])
            if not command:
                command = "_get_signatures_"
        except:
            command, params, keyword_params = "_get_signatures_", [], {}

        if command not in self._callbacks:
            return connection.ERROR(['No such command: %s' % command])
        res = self._callbacks[command](connection, *params, **keyword_params)
        return res
Пример #2
0
    def process_upload_request(self, start_response, environ):
        connection = make_server_connection(start_response, environ,
            connection_protocol=self.connection_protocol)
        filename, filedata = connection.load_file()

        return self._callbacks[command](connection, filename, filedata)