Reinstated EventAdmin fieldsets and added some options. Filled out the page requireme...
[philo.git] / contrib / julian / feedgenerator.py
index 274f617..23efdca 100644 (file)
@@ -1,3 +1,4 @@
+from django.http import HttpResponse
 from django.utils.feedgenerator import SyndicationFeed
 import vobject
 
@@ -74,4 +75,10 @@ class ICalendarFeed(SyndicationFeed):
                                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