Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix bug 869301: Build document links in revision feed using document …

…locale, not request locale
  • Loading branch information...
commit 6c6041a0c5dbbe528ac37b1a24af9171678f0628 1 parent cba5196
@lmorchard lmorchard authored
Showing with 25 additions and 1 deletion.
  1. +3 −1 apps/wiki/feeds.py
  2. +22 −0 apps/wiki/tests/test_feeds.py
View
4 apps/wiki/feeds.py
@@ -357,7 +357,9 @@ def item_description(self, item):
return description
def item_link(self, item):
- return reverse('wiki.document', args=[item.document.full_path])
+ return self.request.build_absolute_uri(
+ reverse('wiki.views.document', locale=item.document.locale,
+ args=(item.document.slug,)))
def item_pubdate(self, item):
return item.created
View
22 apps/wiki/tests/test_feeds.py
@@ -104,6 +104,28 @@ def test_revisions_feed(self):
ok_('Revision 3' in resp.content)
ok_('Revision 2' in resp.content)
+ def test_bug869301_revisions_feed_locale(self):
+ """Links to documents in revisions feed with ?all_locales should
+ reflect proper document locale, regardless of requestor's locale"""
+ d = document(title='HTML9', locale="fr")
+ d.save()
+ for i in xrange(1, 6):
+ revision(save=True, document=d,
+ title='HTML9', comment='Revision %s' % i,
+ content="Some Content %s" % i,
+ is_approved=True,
+ created=datetime.datetime.now()\
+ + datetime.timedelta(seconds=5 * i))
+
+ resp = self.client.get('%s?all_locales' %
+ reverse('wiki.feeds.recent_revisions',
+ args=(), kwargs={'format': 'rss'}, locale='en-US'))
+ eq_(200, resp.status_code)
+ feed = pq(resp.content)
+ eq_(5, len(feed.find('item')))
+ for i, item in enumerate(feed.find('item')):
+ href = pq(item).find('link').text()
+ ok_('/fr/' in href)
def test_revisions_feed_diffs(self):
d = document(title='HTML9')
Please sign in to comment.
Something went wrong with that request. Please try again.