Skip to content
This repository
Browse code

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

…matching

config is found.
  • Loading branch information...
commit 2cde902af3969e822e35bf3a14a5b66018f3b765 1 parent c88afaa
David Sveningsson ext authored

Showing 1 changed file with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +9 5 planet/shell/_genshi.py
14 planet/shell/_genshi.py
@@ -3,7 +3,9 @@
3 3
4 4 from genshi.input import HTMLParser, XMLParser
5 5 from genshi.template import Context, MarkupTemplate
  6 +import planet
6 7
  8 +log = planet.logger
7 9 subscriptions = []
8 10 feed_types = [
9 11 'application/atom+xml',
@@ -28,13 +30,15 @@ def find_config(config, feed):
28 30 if link.has_key('type') and link.type in feed_types:
29 31 if link.has_key('href') and link.href in subscriptions:
30 32 return norm(dict(config.parser.items(link.href)))
31   -
  33 +
32 34 # match based on name
33   - for sub in subscriptions:
34   - if config.parser.has_option(sub, 'name') and \
35   - norm(config.parser.get(sub, 'name')) == feed.planet_name:
36   - return norm(dict(config.parser.items(sub)))
  35 + if 'planet_name' in feed:
  36 + for sub in subscriptions:
  37 + if config.parser.has_option(sub, 'name') and \
  38 + norm(config.parser.get(sub, 'name')) == feed.planet_name:
  39 + return norm(dict(config.parser.items(sub)))
37 40
  41 + log.warning('Could not match subscription to config: %s', feed.link)
38 42 return {}
39 43
40 44 class XHTMLParser(object):

0 comments on commit 2cde902

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