]> git.openstreetmap.org Git - osqa.git/commitdiff
make the redirects 301 instead of 302
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 17 Apr 2010 15:55:49 +0000 (15:55 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 17 Apr 2010 15:55:49 +0000 (15:55 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@48 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py

index 5f583444e2d80e44505df9413cd559ddbe1b4943..2e2c002fc9fec384f80f2f76002a1678e2f03205 100644 (file)
@@ -4,7 +4,7 @@ import logging
 from urllib import unquote
 from django.conf import settings as django_settings
 from django.shortcuts import render_to_response, get_object_or_404
 from urllib import unquote
 from django.conf import settings as django_settings
 from django.shortcuts import render_to_response, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404
+from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404, HttpResponsePermanentRedirect
 from django.core.paginator import Paginator, EmptyPage, InvalidPage
 from django.template import RequestContext
 from django import template
 from django.core.paginator import Paginator, EmptyPage, InvalidPage
 from django.template import RequestContext
 from django import template
@@ -214,16 +214,12 @@ def question(request, id, slug):
     except:
         question = match_question_slug(slug)
         if question is not None:
     except:
         question = match_question_slug(slug)
         if question is not None:
-            return HttpResponseRedirect(question.get_absolute_url())
+            return HttpResponsePermanentRedirect(question.get_absolute_url())
         else:
             raise Http404()
 
     if slug != urlquote(slugify(question.title)):
         else:
             raise Http404()
 
     if slug != urlquote(slugify(question.title)):
-        match = match_question_slug(slug)
-        if match is not None:
-            return HttpResponseRedirect(match.get_absolute_url())    
-
-        return HttpResponseRedirect(question.get_absolute_url())
+        return HttpResponsePermanentRedirect(question.get_absolute_url())
 
     page = int(request.GET.get('page', 1))
     view_id, order_by = get_answer_sort_order(request)
 
     page = int(request.GET.get('page', 1))
     view_id, order_by = get_answer_sort_order(request)