view OpmlImport.py @ 83:19394162a39d

Automated merge with ssh://xanthippe.dyndns.org//home/dirk/Projekte/Python/Feedworm
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 22 Aug 2010 16:35:08 +0200
parents b8d209fdad14
children bb3c851b18b1
line wrap: on
line source


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()