def send(self, data): data = smart_str(data) return DTPHandler.send(self, data)
def send(self, data): data = smart_str(data) return DTPHandler.send(self, data) def close(self): if self.file_obj is not None and not self.file_obj.closed: try: self.file_obj.close() except Exception, e: msg = u"Data connection error (%s)" % e self.cmd_channel.log(msg) self.cmd_channel.respond(u"421 " + msg) finally: self.file_obj = None DTPHandler.close(self) class MyFTPHandler(FTPHandler): # don't kick off client in long time transactions timeout = 0 dtp_handler = MyDTPHandler authorizer = ObjectStorageAuthorizer() max_cons_per_ip = 0 use_sendfile = False @staticmethod def abstracted_fs(root, cmd_channel): """Get an AbstractedFs for the user logged in on the cmd_channel.""" cffs = cmd_channel.authorizer.get_abstracted_fs(cmd_channel.username) cffs.init_abstracted_fs(root, cmd_channel)
def send(self, data): data = smart_str(data) return DTPHandler.send(self, data) def close(self): if self.file_obj is not None and not self.file_obj.closed: try: self.file_obj.close() except Exception, e: msg = u"Data connection error (%s)" % e self.cmd_channel.log(msg) self.cmd_channel.respond(u"421 " + msg) finally: self.file_obj = None DTPHandler.close(self) class MyFTPHandler(FTPHandler): # don't kick off client in long time transactions timeout = 0 dtp_handler = MyDTPHandler authorizer = ObjectStorageAuthorizer() max_cons_per_ip = 0 use_sendfile = False @staticmethod def abstracted_fs(root, cmd_channel): """Get an AbstractedFs for the user logged in on the cmd_channel.""" cffs = cmd_channel.authorizer.get_abstracted_fs(cmd_channel.username) cffs.init_abstracted_fs(root, cmd_channel) return cffs
def send(self, data): tot_bytes_sent = DTPHandler.send(self, data) return tot_bytes_sent