# HG changeset patch # User Paul Boddie # Date 1340576412 -7200 # Node ID 5fe139a6aeb1ac11ebe97dab903feadf2f2f8983 # Parent 635de7896589517cde6aa320a742d4bbaa27d298 Added usage of the content preferences support from MoinSupport. diff -r 635de7896589 -r 5fe139a6aeb1 actions/SharedUpdates.py --- a/actions/SharedUpdates.py Sun Jun 24 21:57:23 2012 +0200 +++ b/actions/SharedUpdates.py Mon Jun 25 00:20:12 2012 +0200 @@ -99,11 +99,13 @@ headers = ["Content-Type: application/atom+xml; charset=%s" % config.charset] # Define the last modified time. - # NOTE: We could get edits since a certain time and only process those. + # NOTE: We could attempt to get the last edit time of the fragment. page = Page(request, pagename) metadata = getMetadata(page) + # NOTE: Consider using request.httpDate. + if metadata.has_key("last-modified"): latest_timestamp = metadata["last-modified"] headers.append("Last-Modified: %s" % latest_timestamp.as_HTTP_datetime_string()) @@ -160,12 +162,16 @@ else: mimetypes = ["text/html"] - # NOTE: Perform content negotiation, obtaining mimetypes common to the - # NOTE: fragment and the client. + # Perform content negotiation, obtaining mimetypes common to the + # fragment and the client. + + accept = getHeader(request, "Accept", "HTTP") + prefs = getContentPreferences(accept) + preferred = prefs.get_preferred_types(mimetypes) download_links = [] - for mimetype in mimetypes: + for mimetype in preferred: specific_link = "%s&mimetype=%s" % (fragment_link, mimetype) download_links.append('' % (