def get_local_file_size(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = GetLocalFileSizeRsp() filedir = cmd.path[7:] if os.path.exists(filedir): rsp.size = linux.get_local_file_size(filedir) else: rsp.size = 0 rsp.success = False rsp.error = "The file is not exist" return jsonobject.dumps(rsp)
def get_local_file_size(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = GetLocalFileSizeRsp() rsp.size = linux.get_local_file_size(cmd.path) return jsonobject.dumps(rsp)