def GetPrefix(self, subject_prefix): """Return list of databases matching subject_prefix.""" components = common.Components(subject_prefix) components = [common.ConvertStringToFilename(x) for x in components] path_prefix = utils.JoinPath(*components) if path_prefix == "/": path_prefix = "" for regex in self.path_regexes: result = common.EvaluatePrefix(path_prefix, regex) if result == "MATCH": yield self.Get(subject_prefix) return if result == "POSSIBLE": for conn in self.DatabasesByPath(path_prefix): yield conn return yield self.Get(subject_prefix)
def GetPrefix(self, prefix): """Yields all databases which could contain records begining with prefix.""" components = common.Components(prefix) components = [common.ConvertStringToFilename(x) for x in components] path_prefix = utils.JoinPath(*components) if path_prefix == "/": path_prefix = "" for regex in self.path_regexes: result = common.EvaluatePrefix(path_prefix, regex) if result == "MATCH": yield self.Get(prefix) return if result == "POSSIBLE": for data_server in self.AllDatabases(): yield data_server return yield self.Get(prefix)