1.1 --- a/actions/SharedUpdates.py Wed Jul 11 00:52:41 2012 +0200
1.2 +++ b/actions/SharedUpdates.py Sun Jul 15 21:33:24 2012 +0200
1.3 @@ -7,10 +7,8 @@
1.4 """
1.5
1.6 from MoinMoin.action import ActionBase
1.7 -from MoinMoin import config
1.8 from MoinMoin import wikiutil
1.9 from MoinShare import *
1.10 -from DateSupport import getCurrentTime
1.11
1.12 Dependencies = ['pages']
1.13
1.14 @@ -80,30 +78,13 @@
1.15
1.16 pagename = form.get("pagename", [request.page.page_name])[0]
1.17
1.18 - # Output summary data...
1.19 -
1.20 - send_headers = get_send_headers(request)
1.21 -
1.22 - # Define headers.
1.23 -
1.24 - headers = ["Content-Type: application/atom+xml; charset=%s" % config.charset]
1.25 -
1.26 - # Define the last modified time.
1.27 - # NOTE: We could attempt to get the last edit time of the fragment.
1.28 -
1.29 page = Page(request, pagename)
1.30 metadata = getMetadata(page)
1.31
1.32 - # NOTE: Consider using request.httpDate.
1.33 + # Output summary data...
1.34
1.35 - if metadata.has_key("last-modified"):
1.36 - latest_timestamp = metadata["last-modified"]
1.37 - headers.append("Last-Modified: %s" % latest_timestamp.as_HTTP_datetime_string())
1.38 - updated = latest_timestamp.as_ISO8601_datetime_string()
1.39 - else:
1.40 - updated = getCurrentTime().as_ISO8601_datetime_string()
1.41 -
1.42 - send_headers(headers)
1.43 + writeHeaders(request, "application/atom+xml", metadata)
1.44 + updated = getUpdatedTime(metadata)
1.45
1.46 # Atom output...
1.47
1.48 @@ -141,28 +122,16 @@
1.49
1.50 # Get the URL that yields only the fragment.
1.51
1.52 - fragment_link = "%s?action=ShowUpdate&fragment=%s" % (link, fragment)
1.53 -
1.54 - # Get the types available for the fragment.
1.55 - # This uses an extended parser API method if available.
1.56 + fragment_link = "%s?action=SharedUpdate&fragment=%s" % (link, fragment)
1.57
1.58 - parser = getParserClass(request, format)
1.59 - if hasattr(parser, "getOutputTypes"):
1.60 - mimetypes = parser.getOutputTypes()
1.61 - else:
1.62 - mimetypes = ["text/html"]
1.63 + # Get the preferred content types available for the fragment.
1.64
1.65 - # Perform content negotiation, obtaining mimetypes common to the
1.66 - # fragment and the client.
1.67 -
1.68 - accept = getHeader(request, "Accept", "HTTP")
1.69 - prefs = getContentPreferences(accept)
1.70 - preferred = prefs.get_preferred_types(mimetypes)
1.71 + preferred = getPreferredOutputTypes(request, getOutputTypes(request, format))
1.72
1.73 download_links = []
1.74
1.75 for mimetype in preferred:
1.76 - specific_link = "%s&mimetype=%s" % (fragment_link, mimetype)
1.77 + specific_link = "%s&type=%s&doit=1" % (fragment_link, mimetype)
1.78
1.79 download_links.append('<link rel="alternate" type="%s" href="%s"/>' % (
1.80 escattr(mimetype), escattr(specific_link)))