xpath_sifter.py and sys.exit(1) behaviour

Harry Fuecks hfuecks at gmail.com
Wed Oct 18 23:01:54 EST 2006


Trying to use the xpath_sifter.py to limit entries from a feed to a
particular condition;

[xpath_sifter.py]
require:
  //atom:author/atom:name[1][. = 'HarryF']

(the entry has multiple authors, hence atom:name[1]).

If I've understood correctly how filtering and xpath_sifter works, at
the moment on the first entry that fails the condition, spider.py
ignores the rest of the _feed_, rather than just skipping the entry
and going on to the next - not sure if that's intended or not but
looking at spider.py;

def spiderFeed(feed):

    # ...

    for entry in data.entries:

        # ...

        for filter in config.filters(feed):
            output = shell.run(filter, output, mode="filter")
            if not output: return

...it's returning from the function, so the rest of the feed is
ignored - shouldn't that be something like;

        try:
            for filter in config.filters(feed):
                output = shell.run(filter, output, mode="filter")
                if not output: raise Exception
        except: continue

...so just the entry is ignored?


More information about the devel mailing list