Mercurial > hg > Feedworm
annotate OpmlImport.py @ 150:babe14449162
the entries for the selected feeds had to be set onto the item delegate so had access to the selected feed entry. Keep the list in one place only (the model) and access it from the item delegate.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 27 Aug 2011 06:43:28 +0200 |
parents | b8d209fdad14 |
children | bb3c851b18b1 |
rev | line source |
---|---|
63
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
1 |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
2 from Feed import Feed |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
3 from xml.dom.minidom import parse |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
4 |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
5 def createFeedsFromOPML(session=None, filename=None): |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
6 document = parse(filename) |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
7 outlines = document.getElementsByTagName("outline") |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
8 for outline in outlines: |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
9 url = outline.getAttribute("xmlUrl") |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
10 title = outline.getAttribute("title") |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
11 |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
12 feed = Feed(title, url) |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
13 session.add(feed) |
b8d209fdad14
helper class to create Feed objects from an OPML feed
dirk@xanthippe.ping.de
parents:
diff
changeset
|
14 session.commit() |