def validate(self, info, ctx, value): for v in self.__values: if v == value: return True self.error( ctx, "Invalid argument value. Expect " + Util.value_list_display(self.__values, ", ", " or ", "'", "'") ) return False
def validate(self, info, ctx, value): if not os.path.exists(value): self.error(ctx, "Path does not exists") return False if len(self.types) > 0: for t in self.types: if (t == "file") and os.path.isfile(value): return self.access(value) if (t == "folder") and os.path.isdir(value): return self.access(value) if (t == "symlink") and os.path.islink(value): return self.access(value) self.error(ctx, "Invalid path type. Expect " + Util.value_list_display(self.types)) return False else: return self.access(value)