# HG changeset patch # User Paul Boddie # Date 1297813969 -3600 # Node ID 85c24bdd50faf79bbcc15642eb5ef5097d95aeaa # Parent efbca854271739cd2b4b34b0be46a27bcc09e8e2 Introduced usage of the resolution parameter which should have replaced the guesswork around interpreting dates and months since keywords like "current" are ambiguous (meaning both current date and current month, depending on context). diff -r efbca8542717 -r 85c24bdd50fa actions/EventAggregatorSummary.py --- a/actions/EventAggregatorSummary.py Tue Feb 15 00:14:40 2011 +0100 +++ b/actions/EventAggregatorSummary.py Wed Feb 16 00:52:49 2011 +0100 @@ -248,11 +248,12 @@ format = form.get("format", ["iCalendar"])[0] descriptions = form.get("descriptions", ["page"])[0] parent = form.get("parent", [""])[0] + resolution = form.get("resolution", ["month"])[0] - calendar_start = EventAggregatorSupport.getFormDate(request, None, "start") or \ - EventAggregatorSupport.getFormMonth(request, None, "start") - calendar_end = EventAggregatorSupport.getFormDate(request, None, "end") or \ - EventAggregatorSupport.getFormMonth(request, None, "end") + calendar_start = resolution == "date" and EventAggregatorSupport.getFormDate(request, None, "start") or \ + resolution == "month" and EventAggregatorSupport.getFormMonth(request, None, "start") + calendar_end = resolution == "date" and EventAggregatorSupport.getFormDate(request, None, "end") or \ + resolution == "month" and EventAggregatorSupport.getFormMonth(request, None, "end") # Look for separate start and end parameters, either for complete dates # or for years and months. @@ -267,17 +268,6 @@ # Determine the period and get the events involved. - if isinstance(calendar_start, EventAggregatorSupport.Date): - if isinstance(calendar_end, EventAggregatorSupport.Date): - resolution = "date" - else: - calendar_start = calendar_start.as_month() - resolution = "month" - else: - resolution = "month" - if isinstance(calendar_end, EventAggregatorSupport.Date): - calendar_end = calendar_end.as_month() - events, shown_events, all_shown_events, earliest, latest = \ EventAggregatorSupport.getEvents(request, category_names, calendar_start, calendar_end, resolution)