1 from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponsePermanentRedirect
2 from django.template.defaultfilters import slugify
4 from forum.views import readers
5 from forum.modules import decorate
6 from forum.models import Question
8 import settings, logging
10 @decorate(readers.question, needs_origin=True)
11 def match_question_slug(origin, request, id, slug='', answer=None):
17 if settings.MERGE_MAPPINGS and (int(id) in settings.MERGE_MAPPINGS.get('merged_nodes', {})):
19 question = Question.objects.get(id=id)
21 if slug != slugify(question.title):
22 return origin(request, settings.MERGE_MAPPINGS['merged_nodes'][int(id)], slug, answer)
27 return origin(request, id, slug, answer)