Handle WordPress Link Manager dialect of OPML
This commit is contained in:
parent
0a5015d657
commit
6ae4fad6e3
1
THANKS
1
THANKS
@ -9,6 +9,7 @@ Harry Fuecks - Pipe characters in file names, filter bug
|
||||
Eric van der Vlist - Filters to add language, category information
|
||||
Chris Dolan - mkdir cache; default template_dirs; fix xsltproc
|
||||
David Sifry - rss 2.0 xslt template based on http://atom.geekhood.net/
|
||||
Morten Fredericksen - Support WordPress LinkManager OPML
|
||||
|
||||
This codebase represents a radical refactoring of Planet 2.0, which lists
|
||||
the following contributors:
|
||||
|
@ -48,6 +48,10 @@ class OpmlParser(ContentHandler,SGMLParser):
|
||||
# this is an entry in a subscription list, but some leave this
|
||||
# attribute off, and others have placed 'atom' in here
|
||||
if attrs.has_key('type'):
|
||||
if attrs['type'] == 'link' and not attrs.has_key('url'):
|
||||
# Auto-correct WordPress link manager OPML files
|
||||
attrs = dict(attrs.items())
|
||||
attrs['type'] = 'rss'
|
||||
if attrs['type'].lower() not in['rss','atom']: return
|
||||
|
||||
# The feed itself is supposed to be in an attribute named 'xmlUrl'
|
||||
|
@ -76,6 +76,14 @@ class OpmlTest(unittest.TestCase):
|
||||
text="sample feed"/>''', self.config)
|
||||
self.assertFalse(self.config.has_section("http://example.com/feed.xml"))
|
||||
|
||||
def test_WordPress_link_manager(self):
|
||||
# http://www.wasab.dk/morten/blog/archives/2006/10/22/wp-venus
|
||||
opml2config('''<outline type="link"
|
||||
xmlUrl="http://example.com/feed.xml"
|
||||
text="sample feed"/>''', self.config)
|
||||
self.assertEqual('sample feed',
|
||||
self.config.get("http://example.com/feed.xml", 'name'))
|
||||
|
||||
#
|
||||
# xmlUrl
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user