diff options
Diffstat (limited to 'pyaggr3g470r/utils.py')
-rwxr-xr-x | pyaggr3g470r/utils.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/pyaggr3g470r/utils.py b/pyaggr3g470r/utils.py index 0b112615..4d65f14c 100755 --- a/pyaggr3g470r/utils.py +++ b/pyaggr3g470r/utils.py @@ -82,11 +82,34 @@ def import_opml(email, opml_file): except Exception as e: raise e for subscription in subscriptions: - existing_feed = [feed for feed in user.feeds if feed.link == subscription.xmlUrl] - if len(existing_feed) == 0: - new_feed = models.Feed(title=subscription.title, description=subscription.description, link=subscription.xmlUrl, \ - site_link=subscription.htmlUrl, email=False, enabled=True) - user.feeds.append(new_feed) + + try: + title = subscription.text + except: + title = "" + print title + try: + description = subscription.description + except: + description = "" + + try: + link = subscription.xmlUrl + except: + continue + + existing_feed = [feed for feed in user.feeds if feed.link == link] + if len(existing_feed) != 0: + continue + + try: + site_link = subscription.htmlUrl + except: + site_link = "" + + new_feed = models.Feed(title=title, description=description, link=link, site_link=site_link, email=False, enabled=True) + user.feeds.append(new_feed) + user.save() def open_url(url): |