Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
fix bug 869301: Build document links in revision feed using document …
Browse files Browse the repository at this point in the history
…locale, not request locale
  • Loading branch information
lmorchard committed May 7, 2013
1 parent cba5196 commit 6c6041a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/wiki/feeds.py
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions apps/wiki/tests/test_feeds.py
Expand Up @@ -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')
Expand Down

0 comments on commit 6c6041a

Please sign in to comment.