]> git.openstreetmap.org Git - osqa.git/commitdiff
Prevents questions on which the slug comes out empty to enter a redirect loop.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 9 Jul 2010 11:31:48 +0000 (11:31 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 9 Jul 2010 11:31:48 +0000 (11:31 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@512 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py

index 4a839b0be81ef3f073cbb5a4518cbc8a0608a2c3..6a490876506c59acaf03e944444d7a6acc3a7511 100644 (file)
@@ -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: