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

config is found.
This commit is contained in:
David Sveningsson 2011-02-15 15:28:14 +01:00
parent c88afaacb0
commit 2cde902af3

View File

@ -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',
@ -30,11 +32,13 @@ def find_config(config, feed):
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):