Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opml import #10

Merged
merged 1 commit into from
Oct 7, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions opml_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from models import Feed

def import_outline_element(o):
for f in o:
if hasattr(f,'xmlUrl'):
new = Feed.objects.create(url = f.xmlUrl,
#tags = self.cleaned_data['tags'],
name = f.title,
)
new.save()
else:
import_outline_element(f)


8 changes: 2 additions & 6 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,10 @@ def bulk_archive(request):

def opml_import(request, url):
import opml
from opml_import import import_outline_element
try:
o = opml.parse(url)
except:
return HttpResponse('Cannot parse opml file %s' % url)
for f in o:
new = Feed.objects.create(url = f.xmlUrl,
#tags = self.cleaned_data['tags'],
name = f.title,
)
new.save()
import_outline_element(o)
return HttpResponse('OK')