Only searches for name if planet_name is set. Prints a warning if no matching
config is found.
This commit is contained in:
parent
c88afaacb0
commit
2cde902af3
@ -3,7 +3,9 @@ from xml.sax.saxutils import escape
|
|||||||
|
|
||||||
from genshi.input import HTMLParser, XMLParser
|
from genshi.input import HTMLParser, XMLParser
|
||||||
from genshi.template import Context, MarkupTemplate
|
from genshi.template import Context, MarkupTemplate
|
||||||
|
import planet
|
||||||
|
|
||||||
|
log = planet.logger
|
||||||
subscriptions = []
|
subscriptions = []
|
||||||
feed_types = [
|
feed_types = [
|
||||||
'application/atom+xml',
|
'application/atom+xml',
|
||||||
@ -30,11 +32,13 @@ def find_config(config, feed):
|
|||||||
return norm(dict(config.parser.items(link.href)))
|
return norm(dict(config.parser.items(link.href)))
|
||||||
|
|
||||||
# match based on name
|
# match based on name
|
||||||
|
if 'planet_name' in feed:
|
||||||
for sub in subscriptions:
|
for sub in subscriptions:
|
||||||
if config.parser.has_option(sub, 'name') and \
|
if config.parser.has_option(sub, 'name') and \
|
||||||
norm(config.parser.get(sub, 'name')) == feed.planet_name:
|
norm(config.parser.get(sub, 'name')) == feed.planet_name:
|
||||||
return norm(dict(config.parser.items(sub)))
|
return norm(dict(config.parser.items(sub)))
|
||||||
|
|
||||||
|
log.warning('Could not match subscription to config: %s', feed.link)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
class XHTMLParser(object):
|
class XHTMLParser(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user