comparison OpmlImport.py @ 63:b8d209fdad14

helper class to create Feed objects from an OPML feed
author dirk@xanthippe.ping.de
date Wed, 28 Jul 2010 21:14:34 +0200
parents
children bb3c851b18b1
comparison
equal deleted inserted replaced
62:abc0516a1c0c 63:b8d209fdad14
1
2 from Feed import Feed
3 from xml.dom.minidom import parse
4
5 def createFeedsFromOPML(session=None, filename=None):
6 document = parse(filename)
7 outlines = document.getElementsByTagName("outline")
8 for outline in outlines:
9 url = outline.getAttribute("xmlUrl")
10 title = outline.getAttribute("title")
11
12 feed = Feed(title, url)
13 session.add(feed)
14 session.commit()