# HG changeset patch # User dirk@xanthippe.ping.de # Date 1280344474 -7200 # Node ID b8d209fdad1455ab43192b7e816dbd9eb50b4b2a # Parent abc0516a1c0c031527a84012c9438ac0a906c56a helper class to create Feed objects from an OPML feed diff -r abc0516a1c0c -r b8d209fdad14 OpmlImport.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpmlImport.py Wed Jul 28 21:14:34 2010 +0200 @@ -0,0 +1,14 @@ + +from Feed import Feed +from xml.dom.minidom import parse + +def createFeedsFromOPML(session=None, filename=None): + document = parse(filename) + outlines = document.getElementsByTagName("outline") + for outline in outlines: + url = outline.getAttribute("xmlUrl") + title = outline.getAttribute("title") + + feed = Feed(title, url) + session.add(feed) + session.commit()