1.1 --- a/actions/SharedUpdates.py Sun Jun 17 01:31:39 2012 +0200
1.2 +++ b/actions/SharedUpdates.py Sun Jun 24 21:57:23 2012 +0200
1.3 @@ -151,10 +151,6 @@
1.4
1.5 fragment_link = "%s?action=ShowUpdate&fragment=%s" % (link, fragment)
1.6
1.7 - request.write('<entry>\r\n')
1.8 - request.write('<title>%s</title>\r\n' % escape(summary))
1.9 - request.write('<id>%s</id>\r\n' % escape(fragment_link))
1.10 -
1.11 # Get the types available for the fragment.
1.12 # This uses an extended parser API method if available.
1.13
1.14 @@ -164,17 +160,34 @@
1.15 else:
1.16 mimetypes = ["text/html"]
1.17
1.18 + # NOTE: Perform content negotiation, obtaining mimetypes common to the
1.19 + # NOTE: fragment and the client.
1.20 +
1.21 + download_links = []
1.22 +
1.23 for mimetype in mimetypes:
1.24 specific_link = "%s&mimetype=%s" % (fragment_link, mimetype)
1.25
1.26 - request.write('<link rel="alternate" type="%s" href="%s"/>\r\n' % (
1.27 + download_links.append('<link rel="alternate" type="%s" href="%s"/>' % (
1.28 escattr(mimetype), escattr(specific_link)))
1.29
1.30 # NOTE: Could potentially get a summary for the fragment.
1.31 # NOTE: The published and updated details would need to be deduced from
1.32 # NOTE: the page history.
1.33
1.34 - request.write('</entry>\r\n')
1.35 + d = {
1.36 + "title" : escape(summary),
1.37 + "fragment_link" : escape(fragment_link),
1.38 + "download_links" : "\r\n".join(download_links),
1.39 + }
1.40 +
1.41 + request.write('''\
1.42 +<entry>\r
1.43 +<title>%(title)s</title>\r
1.44 +<id>%(fragment_link)s</id>\r
1.45 +%(download_links)s\r
1.46 +</entry>\r
1.47 +''' % d)
1.48
1.49 request.write('</feed>\r\n')
1.50