# HG changeset patch # User Paul Boddie # Date 1350837802 -7200 # Node ID 02276ff148642159332610f10a28bdf918439162 # Parent 3bd63c166dd56ebd829fb4001a1d58b44bd200dc Added HTML option list output originally used in EventAggregator. Added handling of non-existent pages when obtaining page metadata. diff -r 3bd63c166dd5 -r 02276ff14864 MoinSupport.py --- a/MoinSupport.py Sat Sep 29 16:58:57 2012 +0200 +++ b/MoinSupport.py Sun Oct 21 18:43:22 2012 +0200 @@ -412,6 +412,21 @@ return value in input_values and 'selected="selected"' or '' + def get_option_list(self, value, values): + + """ + Return a list of HTML element definitions for options describing the + given 'values', selecting the option with the specified 'value' if + present. + """ + + options = [] + for available_value in values: + selected = self._get_selected(available_value, value) + options.append('' % ( + escattr(available_value), selected, wikiutil.escape(available_value))) + return options + def _get_input(self, form, name, default=None): """ @@ -817,6 +832,10 @@ # Get the initial revision of the page. revisions = page.getRevList() + + if not revisions: + return {} + event_page_initial = Page(request, page.page_name, rev=revisions[-1]) # Get the created and last modified times.