command: Fix opmlexport crash due to orphaned feed data
authorW. Trevor King <wking@tremily.us>
Tue, 14 May 2013 11:03:32 +0000 (07:03 -0400)
committerW. Trevor King <wking@tremily.us>
Tue, 14 May 2013 11:03:32 +0000 (07:03 -0400)
commit67cc85bdcd6152e7c1079ad5b095fbe5668ac306
tree0d74c23382a19b029e4985552ad168be5470907f
parentf75f000523879d8847dcf18c9f24d55907c4c564
command: Fix opmlexport crash due to orphaned feed data

When you remove a feed from your config file by hand, you might leave
the dynamic 'seen' data in the JSON data file by accident.  If you
have such orphan data, the feed is loaded by Feeds._load_feeds() with
the default configuration (since you removed the config file entry).
This can lead to opmlexport errors like:

  Traceback (most recent call last):
    File "./r2e", line 5, in <module>
      rss2email.main.run()
    File "/.../rss2email/rss2email/main.py", line 163, in run
      args.func(feeds=feeds, args=args)
    File "/.../rss2email/rss2email/command.py", line 157, in opmlexport
      url = _saxutils.escape(feed.url)
    File "/usr/lib64/python3.2/xml/sax/saxutils.py", line 34, in escape
      data = data.replace("&", "&amp;")
  AttributeError: 'NoneType' object has no attribute 'replace'

because the feeds lack the per-feed 'url' setting that had been
defined in the config file.  With this commit, opmlexport drops these
URL-less feeds, instead of choking to death trying to format them ;).

Signed-off-by: W. Trevor King <wking@tremily.us>
CHANGELOG
rss2email/command.py