Skip to content
Browse files

Use search collector's error handler to transform results.

Instead of having the error handler directly call the success handler,
just use the normal errback mechanism of error handling to translate
the error into success.
  • Loading branch information...
1 parent cef3809 commit 36938df967f3b6e2851c64a7c8cf7370fd32b16e @dustin committed May 31, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/twitterspy/search_collector.py
View
10 lib/twitterspy/search_collector.py
@@ -20,12 +20,12 @@ def gotResult(self, entry):
).replace(">", ">"
).replace('&', '&')
html="<a href='%s'>%s</a>: %s" % (entry.author.uri, u, hcontent)
+ def errHandler(e):
+ log.err(e)
+ return plain, html
def saveResults(t):
p, h = t
bisect.insort(self.results, (eid, p, h))
- def errHandler(e):
- log.err(e)
- saveResults((plain, html))
- d = url_expansion.expander.expand(plain, html).addCallback(
- saveResults).addErrback(errHandler)
+ d = url_expansion.expander.expand(plain, html).addErrback(
+ errHandler).addCallback(saveResults)
self.deferreds.append(d)

0 comments on commit 36938df

Please sign in to comment.
Something went wrong with that request. Please try again.