+from django.http import HttpResponse
from django.utils.feedgenerator import SyndicationFeed
import vobject
if key in ITEM_ICAL_MAP and val:
event.add(ITEM_ICAL_MAP[key]).value = val
- cal.serialize(outfile)
\ No newline at end of file
+ cal.serialize(outfile)
+
+ # Some special handling for HttpResponses. See link above.
+ if isinstance(outfile, HttpResponse):
+ filename = self.feed.get('filename', 'filename.ics')
+ outfile['Filename'] = filename
+ response['Content-Disposition'] = 'attachment; filename=%s' % filename
\ No newline at end of file