projects
/
zzz-spline-frontpage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2c8a99
)
Don't raise when an RSS source is down.
master
veekun-promotions/2011041101
veekun-promotions/2011041102
veekun-promotions/2011041201
veekun-promotions/2011041501
veekun-promotions/2011041601
author
Eevee
<git@veekun.com>
Sun, 10 Apr 2011 09:24:04 +0000
(
02:24
-0700)
committer
Eevee
<git@veekun.com>
Sun, 10 Apr 2011 09:24:04 +0000
(
02:24
-0700)
splinext/frontpage/sources.py
patch
|
blob
|
history
diff --git
a/splinext/frontpage/sources.py
b/splinext/frontpage/sources.py
index
069b4b6
..
c4c2c54
100644
(file)
--- a/
splinext/frontpage/sources.py
+++ b/
splinext/frontpage/sources.py
@@
-97,6
+97,8
@@
class CachedSource(Source):
and the results are cached. ``poll`` then returns the contents of the
cache.
and the results are cached. ``poll`` then returns the contents of the
cache.
+ ``_poll`` may return None, in which case the cache will be left unchanged.
+
You must define a ``_cache_key`` method that returns a key uniquely
identifying this object. Your key will be combined with the class name, so
it only needs to be unique for that source, not globally.
You must define a ``_cache_key`` method that returns a key uniquely
identifying this object. Your key will be combined with the class name, so
it only needs to be unique for that source, not globally.
@@
-122,7
+124,8
@@
class CachedSource(Source):
return
updates = self._poll(self.limit, self.max_age)
return
updates = self._poll(self.limit, self.max_age)
- cache.get_cache('spline-frontpage')[self.cache_key()] = updates
+ if updates is not None:
+ cache.get_cache('spline-frontpage')[self.cache_key()] = updates
return
return
@@
-166,7
+169,7
@@
class FeedSource(CachedSource):
if feed.bozo and isinstance(feed.bozo_exception, URLError):
# Feed is DOWN. Bail here; otherwise, old entries might be lost
# just because, say, Bulbanews is down yet again
if feed.bozo and isinstance(feed.bozo_exception, URLError):
# Feed is DOWN. Bail here; otherwise, old entries might be lost
# just because, say, Bulbanews is down yet again
- r
aise feed.bozo_exception
+ r
eturn None
if not self.title:
self.title = feed.feed.title
if not self.title:
self.title = feed.feed.title