1.1 --- a/EventAggregatorSupport.py Wed Jun 02 22:27:43 2010 +0200
1.2 +++ b/EventAggregatorSupport.py Thu Jun 10 00:34:21 2010 +0200
1.3 @@ -26,7 +26,7 @@
1.4 except ImportError:
1.5 pytz = None
1.6
1.7 -__version__ = "0.6"
1.8 +__version__ = "0.7"
1.9
1.10 # Date labels.
1.11
1.12 @@ -97,6 +97,49 @@
1.13 else:
1.14 return int(x)
1.15
1.16 +# Utility classes and associated functions.
1.17 +
1.18 +Undefined = object()
1.19 +
1.20 +class Form:
1.21 +
1.22 + """
1.23 + A wrapper preserving MoinMoin 1.8.x (and earlier) behaviour in a 1.9.x
1.24 + environment.
1.25 + """
1.26 +
1.27 + def __init__(self, form):
1.28 + self.form = form
1.29 +
1.30 + def get(self, name, default=Undefined):
1.31 + values = self.form.getlist(name)
1.32 + if not values:
1.33 + if default is Undefined:
1.34 + return []
1.35 + else:
1.36 + return default
1.37 + else:
1.38 + return values
1.39 +
1.40 + def __getitem__(self, name):
1.41 + return self.form.getlist(name)
1.42 +
1.43 +class ActionSupport:
1.44 +
1.45 + "Work around disruptive MoinMoin changes in 1.9."
1.46 +
1.47 + def get_form(self):
1.48 + return get_form(self.request)
1.49 +
1.50 +def get_form(request):
1.51 +
1.52 + "Work around disruptive MoinMoin changes in 1.9."
1.53 +
1.54 + if hasattr(request, "values"):
1.55 + return Form(request.values)
1.56 + else:
1.57 + return request.form
1.58 +
1.59 # Textual representations.
1.60
1.61 def getHTTPTimeString(tmtuple):
2.1 --- a/PKG-INFO Wed Jun 02 22:27:43 2010 +0200
2.2 +++ b/PKG-INFO Thu Jun 10 00:34:21 2010 +0200
2.3 @@ -1,6 +1,6 @@
2.4 Metadata-Version: 1.1
2.5 Name: EventAggregator
2.6 -Version: 0.6
2.7 +Version: 0.7
2.8 Author: Paul Boddie
2.9 Author-email: paul at boddie org uk
2.10 Maintainer: Paul Boddie
3.1 --- a/README.txt Wed Jun 02 22:27:43 2010 +0200
3.2 +++ b/README.txt Thu Jun 10 00:34:21 2010 +0200
3.3 @@ -224,6 +224,15 @@
3.4 time zone information for the correct interpretation of time information in
3.5 those summaries. Thus, it is highly recommended that pytz be installed.
3.6
3.7 +New in EventAggregator 0.7 (Changes since EventAggregator 0.6)
3.8 +--------------------------------------------------------------
3.9 +
3.10 + * Fixed form handling to be compatible with MoinMoin 1.9.x, since that
3.11 + particular release series introduced an incompatible request API that
3.12 + breaks existing code (no longer providing access to query string
3.13 + parameters via the form attribute, and only returning single values
3.14 + unless the new getlist method on form-like objects is used).
3.15 +
3.16 New in EventAggregator 0.6 (Changes since EventAggregator 0.5)
3.17 --------------------------------------------------------------
3.18
4.1 --- a/actions/EventAggregatorNewEvent.py Wed Jun 02 22:27:43 2010 +0200
4.2 +++ b/actions/EventAggregatorNewEvent.py Thu Jun 10 00:34:21 2010 +0200
4.3 @@ -24,7 +24,7 @@
4.4
4.5 # Action class and supporting functions.
4.6
4.7 -class EventAggregatorNewEvent(ActionBase):
4.8 +class EventAggregatorNewEvent(ActionBase, EventAggregatorSupport.ActionSupport):
4.9
4.10 "An event creation dialogue requesting various parameters."
4.11
4.12 @@ -44,7 +44,7 @@
4.13 def get_form_html(self, buttons_html):
4.14 _ = self._
4.15 request = self.request
4.16 - form = request.form
4.17 + form = self.get_form()
4.18
4.19 # Handle advanced and basic forms, and enable/disable certain fields.
4.20
4.21 @@ -465,7 +465,7 @@
4.22 "Create the new event."
4.23
4.24 _ = self._
4.25 - form = self.request.form
4.26 + form = self.get_form()
4.27
4.28 # If no title exists in the request, an error message is returned.
4.29
4.30 @@ -495,7 +495,7 @@
4.31 "Create an event page using the 'request'."
4.32
4.33 _ = request.getText
4.34 - form = request.form
4.35 + form = self.get_form()
4.36
4.37 category_pagenames = form.get("category", [])
4.38 description = form.get("description", [None])[0]
5.1 --- a/actions/EventAggregatorSummary.py Wed Jun 02 22:27:43 2010 +0200
5.2 +++ b/actions/EventAggregatorSummary.py Thu Jun 10 00:34:21 2010 +0200
5.3 @@ -22,14 +22,14 @@
5.4
5.5 # Action class and supporting functions.
5.6
5.7 -class EventAggregatorSummary(ActionBase):
5.8 +class EventAggregatorSummary(ActionBase, EventAggregatorSupport.ActionSupport):
5.9
5.10 "A summary dialogue requesting various parameters."
5.11
5.12 def get_form_html(self, buttons_html):
5.13 _ = self._
5.14 request = self.request
5.15 - form = request.form
5.16 + form = self.get_form()
5.17
5.18 category_list = []
5.19
5.20 @@ -138,7 +138,7 @@
5.21 "Write the iCalendar resource."
5.22
5.23 _ = self._
5.24 - form = self.request.form
5.25 + form = self.get_form()
5.26
5.27 # If no category names exist in the request, an error message is
5.28 # returned.
5.29 @@ -176,7 +176,7 @@
5.30 can be specified.
5.31 """
5.32
5.33 - form = request.form
5.34 + form = EventAggregatorSupport.get_form(request)
5.35
5.36 category_names = form.get("category", [])
5.37 format = form.get("format", ["iCalendar"])[0]
6.1 --- a/setup.py Wed Jun 02 22:27:43 2010 +0200
6.2 +++ b/setup.py Thu Jun 10 00:34:21 2010 +0200
6.3 @@ -8,6 +8,6 @@
6.4 author = "Paul Boddie",
6.5 author_email = "paul@boddie.org.uk",
6.6 url = "http://moinmo.in/MacroMarket/EventAggregator",
6.7 - version = "0.6",
6.8 + version = "0.7",
6.9 py_modules = ["EventAggregatorSupport", "MoinMoin.script.import.eventfeed"]
6.10 )