Merge lp:~mnordhoff/loggerhead/valid-feed into lp:loggerhead

Proposed by Matt Nordhoff
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mnordhoff/loggerhead/valid-feed
Merge into: lp:loggerhead
Diff against target: None lines
To merge this branch: bzr merge lp:~mnordhoff/loggerhead/valid-feed
Reviewer Review Type Date Requested Status
Martin Albisetti Approve
Review via email: mp+7146@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

This makes the Atom feed valid (bug #247162).

There's still one warning left because the URLs used in the <id>s are URL-encoded, so they're not in the "canonical form". I don't know what should be done, and it's just a warning, so it's probably not vital. Anyway, I'm not making it any *worse*.

At least I fixed all of the outright errors.

"change" objects store only the commit time, in local time, with no time zone information, while Atom feeds need a time + time zone. (See bug #376842.) As a simple, non-invasive and slightly evil solution, I just added a "utc_date" attribute and use UTC time in the feed. There are better fixes available, but it would be more complicated, and dealing with time zones makes my brain hurt, so this is all you're going to get from me any time soon. :P

lp:~mnordhoff/loggerhead/valid-feed updated
353. By Matt Nordhoff

Syntax (whitespace) tweak

Revision history for this message
Martin Albisetti (beuno) wrote :

Looks good, go ahead and merge.

review: Approve

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-06-05 01:59:11 +0000
+++ NEWS 2009-06-06 09:26:45 +0000
@@ -124,6 +124,8 @@
124124
125 - Fix logging 404 Not Found responses (Matt Nordhoff, #381029)125 - Fix logging 404 Not Found responses (Matt Nordhoff, #381029)
126126
127 - Make sure the Atom feeds (nearly) validate. (Matt Nordhoff, #247162)
128
1271.10 [22Dec2008]1291.10 [22Dec2008]
128---------------130---------------
129131
130132
=== modified file 'loggerhead/controllers/atom_ui.py'
--- loggerhead/controllers/atom_ui.py 2008-12-05 18:52:44 +0000
+++ loggerhead/controllers/atom_ui.py 2009-06-06 09:09:55 +0000
@@ -35,6 +35,6 @@
35 headers['Content-Type'] = 'application/atom+xml'35 headers['Content-Type'] = 'application/atom+xml'
36 return {36 return {
37 'changes': entries,37 'changes': entries,
38 'updated': entries[0].date.isoformat() + 'Z',38 'updated': entries[0].utc_date.isoformat(),
39 'history': self._history,39 'history': self._history,
40 }40 }
4141
=== modified file 'loggerhead/history.py'
--- loggerhead/history.py 2009-05-28 22:48:45 +0000
+++ loggerhead/history.py 2009-06-06 09:16:19 +0000
@@ -660,8 +660,6 @@
660 Given a bzrlib Revision, return a processed "change" for use in660 Given a bzrlib Revision, return a processed "change" for use in
661 templates.661 templates.
662 """662 """
663 commit_time = datetime.datetime.fromtimestamp(revision.timestamp)
664
665 parents = [util.Container(revid=r,663 parents = [util.Container(revid=r,
666 revno=self.get_revno(r)) for r in revision.parent_ids]664 revno=self.get_revno(r)) for r in revision.parent_ids]
667665
@@ -674,7 +672,8 @@
674672
675 entry = {673 entry = {
676 'revid': revision.revision_id,674 'revid': revision.revision_id,
677 'date': commit_time,675 'date': datetime.datetime.fromtimestamp(revision.timestamp),
676 'utc_date': datetime.datetime.utcfromtimestamp(revision.timestamp),
678 'authors': authors,677 'authors': authors,
679 'branch_nick': revision.properties.get('branch-nick', None),678 'branch_nick': revision.properties.get('branch-nick', None),
680 'short_comment': short_message,679 'short_comment': short_message,
681680
=== modified file 'loggerhead/templates/atom.pt'
--- loggerhead/templates/atom.pt 2009-03-06 09:57:54 +0000
+++ loggerhead/templates/atom.pt 2009-06-06 09:25:53 +0000
@@ -3,17 +3,19 @@
3 <title>3 <title>
4 bazaar changes for <tal:branch-name content="branch/friendly_name">branch name</tal:branch-name>4 bazaar changes for <tal:branch-name content="branch/friendly_name">branch name</tal:branch-name>
5 </title>5 </title>
6 <updated tal:content="updated">${updated}</updated>6 <updated tal:content="string:${updated}Z">${updated}</updated>
7 <id tal:content="python:branch.url(['/atom'])">url</id>7 <id tal:content="python:branch.url(['/atom'])">url</id>
8 <link rel="self" tal:attributes="href python:branch.url([''])" />8 <link rel="self" type="application/atom+xml" tal:attributes="href python:branch.url(['/atom'])" />
9 <link rel="alternate" type="text/html" tal:attributes="href python:branch.url(['/changes'])" />
910
10 <entry tal:repeat="entry changes">11 <entry tal:repeat="entry changes">
11 <title tal:content="string: ${entry/revno}: ${entry/short_comment}">12 <title tal:content="string: ${entry/revno}: ${entry/short_comment}">
12 ${entry/revno}: ${entry/short_comment}13 ${entry/revno}: ${entry/short_comment}
13 </title>14 </title>
14 <updated tal:content="entry/date/isoformat">15 <updated tal:content="string: ${entry/utc_date/isoformat}Z">
15 Z16 updated
16 </updated>17 </updated>
18 <!-- TODO: The feed validator will generate warnings because this is URL-encoded -->
17 <id tal:content="python:branch.url(['/revision', entry.revno])">19 <id tal:content="python:branch.url(['/revision', entry.revno])">
18 ID20 ID
19 </id>21 </id>
@@ -25,7 +27,7 @@
25 <content type="text" tal:content="entry/comment">27 <content type="text" tal:content="entry/comment">
26 comment28 comment
27 </content>29 </content>
28 <link rel="alternate"30 <link rel="alternate" type="text/html"
29 tal:attributes="href python:branch.url(['/revision', entry.revno])" />31 tal:attributes="href python:branch.url(['/revision', entry.revno])" />
30 </entry>32 </entry>
31</feed>33</feed>

Subscribers

People subscribed via source and target branches