1.1 --- a/EventAggregatorSupport/Formatting.py Sun Apr 06 23:35:52 2014 +0200
1.2 +++ b/EventAggregatorSupport/Formatting.py Mon Apr 07 23:16:49 2014 +0200
1.3 @@ -79,7 +79,26 @@
1.4
1.5 write(fmt.definition_list(on=0))
1.6
1.7 -def formatEventsForOutputType(events, request, mimetype, parent=None, descriptions=None, latest_timestamp=None, write=None):
1.8 +def formatMethod(resource, request, fmt, write=None):
1.9 +
1.10 + "Where the 'resource' has a method, offer iTIP actions."
1.11 +
1.12 + method = resource.getMethod()
1.13 +
1.14 + if method:
1.15 + _ = request.getText
1.16 + write = write or request.write
1.17 + write(fmt.paragraph(on=1))
1.18 + write(fmt.span(on=1))
1.19 + write(fmt.text(_("iTIP method")))
1.20 + write(fmt.span(on=0))
1.21 + write(" ")
1.22 + write(fmt.span(on=1))
1.23 + write(fmt.text(method))
1.24 + write(fmt.span(on=0))
1.25 + write(fmt.paragraph(on=0))
1.26 +
1.27 +def formatEventsForOutputType(events, request, mimetype, parent=None, descriptions=None, latest_timestamp=None, write=None, resource=None):
1.28
1.29 """
1.30 Format the given 'events' using the 'request' for the given 'mimetype'.
1.31 @@ -95,6 +114,9 @@
1.32 of the page or event collection.
1.33
1.34 If the 'write' parameter is specified, use it to write output.
1.35 +
1.36 + If the 'resource' parameter is specified, use it to write any resource-level
1.37 + information such as iTIP method information.
1.38 """
1.39
1.40 write = write or request.write
1.41 @@ -136,7 +158,7 @@
1.42 # Output the collection one by one.
1.43
1.44 for event in events:
1.45 - formatEventForOutputType(event, request, mimetype, parent, descriptions, write)
1.46 + formatEventForOutputType(event, request, mimetype, parent, descriptions, write, resource)
1.47
1.48 # End the collection.
1.49
1.50 @@ -151,7 +173,7 @@
1.51 write('</body>')
1.52 write('</html>')
1.53
1.54 -def formatEventForOutputType(event, request, mimetype, parent=None, descriptions=None, write=None):
1.55 +def formatEventForOutputType(event, request, mimetype, parent=None, descriptions=None, write=None, resource=None):
1.56
1.57 """
1.58 Format the given 'event' using the 'request' for the given 'mimetype'.
1.59 @@ -164,6 +186,9 @@
1.60 for events in the output resource.
1.61
1.62 If the 'write' parameter is specified, use it to write output.
1.63 +
1.64 + If the 'resource' parameter is specified, use it to write any resource-level
1.65 + information such as iTIP method information.
1.66 """
1.67
1.68 write = write or request.write
1.69 @@ -260,6 +285,8 @@
1.70 fmt = request.html_formatter
1.71 fmt.setPage(request.page)
1.72 formatEvent(event, request, fmt, write=write)
1.73 + if resource:
1.74 + formatMethod(resource, request, fmt, write)
1.75
1.76 # iCalendar format helper functions.
1.77