From 7cdc19bcfed965828015c882bed2cd82a7f442d7 Mon Sep 17 00:00:00 2001 From: hernani Date: Fri, 9 Jul 2010 11:31:48 +0000 Subject: [PATCH] Prevents questions on which the slug comes out empty to enter a redirect loop. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@512 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/views/readers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forum/views/readers.py b/forum/views/readers.py index 4a839b0..6a49087 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -277,7 +277,7 @@ def answer_redirect(request, answer): answer.question.get_absolute_url(), _('page'), page, answer.id)) @decorators.render("question.html", 'questions') -def question(request, id, slug=None, answer=None): +def question(request, id, slug='', answer=None): try: question = Question.objects.get(id=id) except: @@ -305,7 +305,7 @@ def question(request, id, slug=None, answer=None): return answer_redirect(request, answer) - if settings.FORCE_SINGLE_URL and ((not slug) or (slug != slugify(question.title))): + if settings.FORCE_SINGLE_URL and (slug != slugify(question.title)): return HttpResponsePermanentRedirect(question.get_absolute_url()) if request.POST: -- 2.39.5