summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sveningsson <ext@sidvind.com>2011-02-15 15:28:14 +0100
committerDavid Sveningsson <ext@sidvind.com>2011-02-15 15:28:14 +0100
commit2cde902af3969e822e35bf3a14a5b66018f3b765 (patch)
treee6a784c62ecb44243e7d549a82fe4e340fa50d37
parentc88afaacb06cf477c68100018e3e730318558522 (diff)
downloadplanetpixels-2cde902af3969e822e35bf3a14a5b66018f3b765.tar.gz
planetpixels-2cde902af3969e822e35bf3a14a5b66018f3b765.tar.bz2
Only searches for name if planet_name is set. Prints a warning if no matching
config is found.
-rw-r--r--planet/shell/_genshi.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/planet/shell/_genshi.py b/planet/shell/_genshi.py
index fb2a998..7880a3a 100644
--- a/planet/shell/_genshi.py
+++ b/planet/shell/_genshi.py
@@ -3,7 +3,9 @@ from xml.sax.saxutils import escape
from genshi.input import HTMLParser, XMLParser
from genshi.template import Context, MarkupTemplate
+import planet
+log = planet.logger
subscriptions = []
feed_types = [
'application/atom+xml',
@@ -28,13 +30,15 @@ def find_config(config, feed):
if link.has_key('type') and link.type in feed_types:
if link.has_key('href') and link.href in subscriptions:
return norm(dict(config.parser.items(link.href)))
-
+
# match based on name
- for sub in subscriptions:
- if config.parser.has_option(sub, 'name') and \
- norm(config.parser.get(sub, 'name')) == feed.planet_name:
- return norm(dict(config.parser.items(sub)))
+ if 'planet_name' in feed:
+ for sub in subscriptions:
+ if config.parser.has_option(sub, 'name') and \
+ norm(config.parser.get(sub, 'name')) == feed.planet_name:
+ return norm(dict(config.parser.items(sub)))
+ log.warning('Could not match subscription to config: %s', feed.link)
return {}
class XHTMLParser(object):