def write(self, outfile, encoding):
		# TODO: Use encoding... how? Just convert all values when setting them should work...
		cal = vobject.iCalendar()
		
		# IE/Outlook needs this. See
		# <http://blog.thescoop.org/archives/2007/07/31/django-ical-and-vobject/>
		cal.add('method').value = 'PUBLISH'
		
		for key, val in self.feed.items():
			if key in FEED_ICAL_MAP and val:
				cal.add(FEED_ICAL_MAP[key]).value = val
		
		for item in self.items:
			# TODO: handle multiple types of events.
			event = cal.add('vevent')
			for key, val in item.items():
				#TODO: handle the non-standard items like comments and author.
				if key in ITEM_ICAL_MAP and val:
					event.add(ITEM_ICAL_MAP[key]).value = val
		
		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
			outfile['Content-Disposition'] = 'attachment; filename=%s' % filename
dataset/ETHPy150Open ithinksw/philo/philo/contrib/julian/feedgenerator.py/ICalendarFeed.write/original