Skip to content

Commit

Permalink
[bug 658769] Include locale in kbforum URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlr committed Oct 25, 2012
1 parent caa9581 commit 55aa32d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/kbforums/models.py
Expand Up @@ -67,6 +67,7 @@ def new_post(self, creator, content):

def get_absolute_url(self):
return reverse('wiki.discuss.posts',
locale=self.document.locale,
kwargs={'document_slug': self.document.slug,
'thread_id': self.id})

Expand Down Expand Up @@ -143,6 +144,7 @@ def get_absolute_url(self):
query['page'] = self.page

url_ = reverse('wiki.discuss.posts',
locale=self.thread.document.locale,
kwargs={'document_slug': self.thread.document.slug,
'thread_id': self.thread.id})
return urlparams(url_, hash='post-%s' % self.id, **query)
Expand Down
5 changes: 4 additions & 1 deletion apps/kbforums/tests/test_models.py
Expand Up @@ -16,18 +16,21 @@ class KBForumModelTestCase(KBForumTestCase):

def test_thread_absolute_url(self):
t = Thread.objects.get(pk=1)
exp_ = reverse('wiki.discuss.posts', args=[t.document.slug, t.id])
exp_ = reverse('wiki.discuss.posts', locale=t.document.locale,
args=[t.document.slug, t.id])
eq_(exp_, t.get_absolute_url())

def test_post_absolute_url(self):
p = Post.objects.get(pk=1)
url_ = reverse('wiki.discuss.posts',
locale=p.thread.document.locale,
args=[p.thread.document.slug, p.thread.id])
exp_ = urlparams(url_, hash='post-%s' % p.id)
eq_(exp_, p.get_absolute_url())

p = Post.objects.get(pk=24)
url_ = reverse('wiki.discuss.posts',
locale=p.thread.document.locale,
args=[p.thread.document.slug, p.thread.id])
exp_ = urlparams(url_, hash='post-%s' % p.id, page=2)
eq_(exp_, p.get_absolute_url())
Expand Down

0 comments on commit 55aa32d

Please sign in to comment.