class SettingFilterIterator: def __init__(self, it, fil_conf): self.it = it self.fil_conf = fil_conf self._fil = None def __iter__(self): if self._fil is None: self._fil = PaginationFilter() self._fil.addClausesFromConfig(self.fil_conf) for i in self.it: if self._fil.pageMatches(i): yield i
class SettingFilterIterator(object): def __init__(self, it, fil_conf, setting_accessor=None): self.it = it self.fil_conf = fil_conf self._fil = None self.setting_accessor = setting_accessor def __iter__(self): if self._fil is None: self._fil = PaginationFilter(value_accessor=self.setting_accessor) self._fil.addClausesFromConfig(self.fil_conf) for i in self.it: if self._fil.pageMatches(i): yield i