Chris Chambers  committed 7649563

Updated redirects to use the reverse function as well

  • Participants
  • Parent commits 694197f

Comments (0)

Files changed (2)

 from django.conf import settings
 from django.conf.urls.defaults import *
 from django.http import HttpResponsePermanentRedirect
+from django.core.urlresolvers import reverse
 from mango.feeds import atom
 from mango.settings import CONTACT_FORM, PATH_TO_STATIC, TAGS_PAGE
 from mango.views import archives, contact, index, moderate, post, redirect, tagged_as, tags
 urlpatterns += patterns('',
     (r'^$', index),
     (r'^feed/$', atom),
-    (r'^archive/$', lambda request: HttpResponsePermanentRedirect('/archives/')),
     (r'^archives/$', archives),
+    (r'^archive/$', lambda request: HttpResponsePermanentRedirect(reverse('mango.views.archives'))),
     (r'^moderate/(approve|delete|spam)$', moderate),
     (r'^(.+?)/redirect/$', redirect),
     (r'^(.+?)/comment/$', post),
 import disqus
 from django.core.mail import EmailMultiAlternatives, send_mail
+from django.core.urlresolvers import reverse
 from django.http import Http404, HttpResponse, HttpResponseRedirect
 from django.shortcuts import render_to_response
 from django.template import Context, loader
 from django.template.loader import render_to_string
-from django.core.urlresolvers import reverse
 from mango import settings, utils
 from mango.forms import CommentForm, ContactForm
 from mango.settings import *
 def redirect(request, path):
-    return HttpResponseRedirect('/%s/' % path)
+    return HttpResponseRedirect(reverse('', args=[path]))
 def context_defaults(request):
     path_to_css, css = settings.__dict__.get('CSS', (None, []))