Permalink
Browse files

Only searches for name if planet_name is set. Prints a warning if no …

…matching

config is found.
  • Loading branch information...
1 parent c88afaa commit 2cde902af3969e822e35bf3a14a5b66018f3b765 @ext ext committed Feb 15, 2011
Showing with 9 additions and 5 deletions.
  1. +9 −5 planet/shell/_genshi.py
@@ -3,7 +3,9 @@
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):

0 comments on commit 2cde902

Please sign in to comment.