1.1 --- a/EventAggregatorSupport/Resources.py Wed Oct 30 15:58:16 2013 +0100
1.2 +++ b/EventAggregatorSupport/Resources.py Sat Dec 21 00:57:37 2013 +0100
1.3 @@ -75,24 +75,26 @@
1.4 for source in sources:
1.5 try:
1.6 details = sources_dict[source].split()
1.7 + details.extend([None] * (3 - len(details)))
1.8 url = details[0]
1.9 - format = (details[1:] or ["ical"])[0]
1.10 + format = details[1] or "ical"
1.11 + expected_content_type = details[2]
1.12 except (KeyError, ValueError):
1.13 pass
1.14 else:
1.15 - resource = getEventResourcesFromSource(url, format, calendar_start, calendar_end, request)
1.16 + resource = getEventResourcesFromSource(url, format, expected_content_type, calendar_start, calendar_end, request)
1.17 if resource:
1.18 resources.append(resource)
1.19
1.20 return resources
1.21
1.22 -def getEventResourcesFromSource(url, format, calendar_start, calendar_end, request):
1.23 +def getEventResourcesFromSource(url, format, expected_content_type, calendar_start, calendar_end, request):
1.24
1.25 """
1.26 Return a resource object for the given 'url' providing content in the
1.27 - specified 'format', using the given 'calendar_start' and 'calendar_end' to
1.28 - parameterise requests to the sources and the 'request' to access
1.29 - configuration settings in the Wiki.
1.30 + specified 'format', insisting on the 'expected_content_type', and using the
1.31 + given 'calendar_start' and 'calendar_end' to parameterise requests to the
1.32 + sources and the 'request' to access configuration settings in the Wiki.
1.33 """
1.34
1.35 # Prevent local file access.
1.36 @@ -114,7 +116,7 @@
1.37 if format == "ical" and vCalendar is not None:
1.38 parser = vCalendar.parse
1.39 resource_cls = EventCalendar
1.40 - required_content_type = "text/calendar"
1.41 + required_content_type = expected_content_type or "text/calendar"
1.42 else:
1.43 return None
1.44