From 86b819bd11f87da7c299cc9cd3d1c82517e7d3a9 Mon Sep 17 00:00:00 2001 From: Jeremy Carbaugh Date: Fri, 26 Jun 2009 23:57:35 -0400 Subject: [PATCH] removed stupid chainging stuff. what is this, jQuery? --- saucebrush/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/saucebrush/__init__.py b/saucebrush/__init__.py index a00b15e..e58e098 100644 --- a/saucebrush/__init__.py +++ b/saucebrush/__init__.py @@ -11,12 +11,20 @@ class Recipe(filters.Filter): self.rejected = [] def get_filters(self): + filters = [] + for filter_ in self._filter_args: + + # check to see if this is a filter or a recipe + if hasattr(filter_, 'get_filters'): + # load filters from child recipe filters.extend(filter_.get_filters()) + else: filters.append(filter_) + return filters def run(self, source): @@ -39,14 +47,14 @@ class Recipe(filters.Filter): filter_.done() except AttributeError: pass # don't care if there isn't a done method - - return self def run_recipe(source, *filter_args): """ Process data, taking it from a source and applying any number of filters """ - return Recipe(*filter_args).run(source) + r = Recipe(*filter_args) + r.run(source) + return r # experiment with threading - do not use