1.1 --- a/EventAggregatorSupport/View.py Sun Mar 23 01:14:04 2014 +0100
1.2 +++ b/EventAggregatorSupport/View.py Sun Mar 23 01:15:21 2014 +0100
1.3 @@ -6,6 +6,7 @@
1.4 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.5 """
1.6
1.7 +from DateSupport import Date
1.8 from EventAggregatorSupport.Filter import getCalendarPeriod, getEventsInPeriod, \
1.9 getCoverage, getCoverageScale
1.10 from EventAggregatorSupport.Locations import getMapsPage, getLocationsPage, Location
1.11 @@ -140,7 +141,7 @@
1.12
1.13 self.first = first
1.14 self.last = last
1.15 - self.duration = abs(last - first) + 1
1.16 + self.initDuration()
1.17
1.18 if self.calendar_name:
1.19
1.20 @@ -156,6 +157,28 @@
1.21 self.previous_set_end = last.update(-self.duration)
1.22 self.next_set_end = last.update(self.duration)
1.23
1.24 + def initDuration(self):
1.25 +
1.26 + "Limit the duration of the calendar to prevent excessive output."
1.27 +
1.28 + request = self.page.request
1.29 +
1.30 + self.duration = abs(self.last - self.first) + 1
1.31 +
1.32 + # Limit to the specified number of units.
1.33 +
1.34 + limit = int(getattr(request.cfg, "event_aggregator_max_duration", 20))
1.35 +
1.36 + if self.duration > limit:
1.37 + if isinstance(self.first, Date):
1.38 + self.last = self.first.day_update(limit - 1)
1.39 + else:
1.40 + self.last = self.first.month_update(limit - 1)
1.41 +
1.42 + self.calendar_start = self.calendar_start or self.first
1.43 + self.calendar_end = self.calendar_end or self.last
1.44 + self.duration = limit
1.45 +
1.46 def getIdentifier(self):
1.47
1.48 "Return a unique identifier to be used to refer to this view."
2.1 --- a/TO_DO.txt Sun Mar 23 01:14:04 2014 +0100
2.2 +++ b/TO_DO.txt Sun Mar 23 01:15:21 2014 +0100
2.3 @@ -1,9 +1,3 @@
2.4 -View Extents
2.5 -------------
2.6 -
2.7 -It should not be possible for an event to provoke an undesirably large
2.8 -calendar extent, thus creating work for the server and for browsers.
2.9 -
2.10 Navigation Controls
2.11 -------------------
2.12