def open_handler(err, file): print "in open handler" pump = Pump(file, req) def end_handler(): req.end() file.end_handler(end_handler) pump.start()
def open_handler(err, file): rs = file.read_stream pump = Pump(rs, req) def end_handler(stream): req.end() rs.end_handler(end_handler) pump.start()
def file_open(err, file): pump = Pump(req, file) start_time = datetime.now() def end_handler(): def file_close(err, file): end_time = datetime.now() print "Uploaded %d bytes to %s in %s" % ( pump.bytes_pumped, filename, end_time - start_time) req.response.end() file.close(file_close) req.end_handler(end_handler) pump.start() req.resume()
def connect_handler(socket): Pump(socket, socket).start()