1.1 --- a/actions/EventAggregatorSummary.py Sat Apr 02 19:07:50 2011 +0200
1.2 +++ b/actions/EventAggregatorSummary.py Sun Apr 03 02:06:01 2011 +0200
1.3 @@ -15,16 +15,13 @@
1.4 from MoinMoin import config
1.5 from MoinMoin.Page import Page
1.6 from MoinMoin import wikiutil
1.7 -import EventAggregatorSupport
1.8 -
1.9 -escape = EventAggregatorSupport.escape
1.10 -escattr = EventAggregatorSupport.escattr
1.11 +from EventAggregatorSupport import *
1.12
1.13 Dependencies = ['pages']
1.14
1.15 # Action class and supporting functions.
1.16
1.17 -class EventAggregatorSummary(ActionBase, EventAggregatorSupport.ActionSupport):
1.18 +class EventAggregatorSummary(ActionBase, ActionSupport):
1.19
1.20 "A summary dialogue requesting various parameters."
1.21
1.22 @@ -38,10 +35,7 @@
1.23 category_list = []
1.24 category_pagenames = form.get("category", [])
1.25
1.26 - for category_name, category_pagename in \
1.27 - EventAggregatorSupport.getCategoryMapping(
1.28 - EventAggregatorSupport.getCategories(request),
1.29 - request):
1.30 + for category_name, category_pagename in getCategoryMapping(getCategories(request), request):
1.31
1.32 selected = self._get_selected_for_list(category_pagename, category_pagenames)
1.33
1.34 @@ -60,11 +54,11 @@
1.35 end_criteria_default = form.get("end", [""])[0]
1.36
1.37 if resolution == "date":
1.38 - get_parameter = EventAggregatorSupport.getParameterDate
1.39 - get_label = EventAggregatorSupport.getFullDateLabel
1.40 + get_parameter = getParameterDate
1.41 + get_label = getFullDateLabel
1.42 else:
1.43 - get_parameter = EventAggregatorSupport.getParameterMonth
1.44 - get_label = EventAggregatorSupport.getFullMonthLabel
1.45 + get_parameter = getParameterMonth
1.46 + get_label = getFullMonthLabel
1.47
1.48 start_criteria_evaluated = get_parameter(start_criteria_default)
1.49 end_criteria_evaluated = get_parameter(end_criteria_default)
1.50 @@ -242,7 +236,7 @@
1.51 can be specified.
1.52 """
1.53
1.54 - form = EventAggregatorSupport.get_form(request)
1.55 + form = get_form(request)
1.56
1.57 category_names = form.get("category", [])
1.58 format = form.get("format", ["iCalendar"])[0]
1.59 @@ -255,30 +249,31 @@
1.60 # dates or for years and months.
1.61
1.62 if resolution == "date":
1.63 - calendar_start = EventAggregatorSupport.getFormDate(request, None, "start")
1.64 - calendar_end = EventAggregatorSupport.getFormDate(request, None, "end")
1.65 + calendar_start = getFormDate(request, None, "start")
1.66 + calendar_end = getFormDate(request, None, "end")
1.67
1.68 if calendar_start is None:
1.69 - calendar_start = EventAggregatorSupport.getFormDateTriple(request, "start-year", "start-month", "start-day")
1.70 + calendar_start = getFormDateTriple(request, "start-year", "start-month", "start-day")
1.71 if calendar_end is None:
1.72 - calendar_end = EventAggregatorSupport.getFormDateTriple(request, "end-year", "end-month", "end-day")
1.73 + calendar_end = getFormDateTriple(request, "end-year", "end-month", "end-day")
1.74
1.75 elif resolution == "month":
1.76 - calendar_start = EventAggregatorSupport.getFormMonth(request, None, "start")
1.77 - calendar_end = EventAggregatorSupport.getFormMonth(request, None, "end")
1.78 + calendar_start = getFormMonth(request, None, "start")
1.79 + calendar_end = getFormMonth(request, None, "end")
1.80
1.81 if calendar_start is None:
1.82 - calendar_start = EventAggregatorSupport.getFormMonthPair(request, "start-year", "start-month")
1.83 + calendar_start = getFormMonthPair(request, "start-year", "start-month")
1.84 if calendar_end is None:
1.85 - calendar_end = EventAggregatorSupport.getFormMonthPair(request, "end-year", "end-month")
1.86 + calendar_end = getFormMonthPair(request, "end-year", "end-month")
1.87
1.88 # Determine the period and get the events involved.
1.89
1.90 - events, shown_events, all_shown_events, earliest, latest = \
1.91 - EventAggregatorSupport.getEvents(request, category_names, calendar_start, calendar_end,
1.92 - resolution)
1.93 + event_pages = getPagesFromResults(getAllCategoryPages(category_names, request), request)
1.94 + events = getEventsFromPages(event_pages)
1.95 + calendar_period = getCalendarPeriod(calendar_start, calendar_end, resolution)
1.96 + all_shown_events = getEventsInPeriod(events, calendar_period, resolution)
1.97
1.98 - latest_timestamp = EventAggregatorSupport.setEventTimestamps(request, all_shown_events)
1.99 + latest_timestamp = setEventTimestamps(request, all_shown_events)
1.100
1.101 # Output summary data...
1.102
1.103 @@ -287,7 +282,7 @@
1.104 elif hasattr(request, "emit_http_headers"):
1.105 send_headers = request.emit_http_headers
1.106 else:
1.107 - send_headers = EventAggregatorSupport.send_headers(request)
1.108 + send_headers = send_headers(request)
1.109
1.110 # Define headers.
1.111
1.112 @@ -299,7 +294,7 @@
1.113 # Define the last modified time.
1.114
1.115 if latest_timestamp is not None:
1.116 - headers.append("Last-Modified: %s" % EventAggregatorSupport.getHTTPTimeString(latest_timestamp))
1.117 + headers.append("Last-Modified: %s" % getHTTPTimeString(latest_timestamp))
1.118
1.119 send_headers(headers)
1.120
1.121 @@ -331,13 +326,13 @@
1.122 start = event_details["start"]
1.123 end = event_details["end"]
1.124
1.125 - if isinstance(start, EventAggregatorSupport.DateTime):
1.126 + if isinstance(start, DateTime):
1.127 request.write("DTSTART")
1.128 write_calendar_datetime(request, start)
1.129 else:
1.130 request.write("DTSTART;VALUE=DATE:%04d%02d%02d\r\n" % start.as_date().as_tuple())
1.131
1.132 - if isinstance(end, EventAggregatorSupport.DateTime):
1.133 + if isinstance(end, DateTime):
1.134 request.write("DTEND")
1.135 write_calendar_datetime(request, end)
1.136 else:
1.137 @@ -377,7 +372,7 @@
1.138 request.write('<description>Events published on %s%s</description>\r\n' % (request.getBaseURL(), path_info))
1.139
1.140 if latest_timestamp is not None:
1.141 - request.write('<lastBuildDate>%s</lastBuildDate>\r\n' % EventAggregatorSupport.getHTTPTimeString(latest_timestamp))
1.142 + request.write('<lastBuildDate>%s</lastBuildDate>\r\n' % getHTTPTimeString(latest_timestamp))
1.143
1.144 # Sort all_shown_events by start date, reversed:
1.145 #
1.146 @@ -386,7 +381,7 @@
1.147 #
1.148 # So we use as sorting key the "start" key from the event details.
1.149
1.150 - ordered_events = EventAggregatorSupport.getOrderedEvents(all_shown_events)
1.151 + ordered_events = getOrderedEvents(all_shown_events)
1.152 ordered_events.reverse()
1.153
1.154 for event in ordered_events:
1.155 @@ -415,7 +410,7 @@
1.156 for topic in event_details.get("topics") or event_details.get("categories") or []:
1.157 request.write('<category>%s</category>\r\n' % topic)
1.158
1.159 - request.write('<pubDate>%s</pubDate>\r\n' % EventAggregatorSupport.getHTTPTimeString(event_details["created"]))
1.160 + request.write('<pubDate>%s</pubDate>\r\n' % getHTTPTimeString(event_details["created"]))
1.161 request.write('<guid>%s#%s</guid>\r\n' % (link, event_details["sequence"]))
1.162 request.write('</item>\r\n')
1.163