Commits

David Chambers  committed 62f85a2

Updated `redirect` handler to accommodate fragments, and utilized this to improve the commenting experience.

  • Participants
  • Parent commits 12b0088

Comments (0)

Files changed (3)

 
     return http.HttpResponse(message, content_type=PLAIN)
 
-def redirect(request, path):
-    return http.HttpResponseRedirect(reverse('mango.views.post', args=[path]))
+def redirect(request, path, fragment=None):
+    return http.HttpResponseRedirect('%s%s' % (
+            reverse('mango.views.post', args=[path]),
+            fragment if fragment else ''))
 
 def unsubscribe(request, path, subscription_id):
     subscription = get_object_or_404(Subscription, pk=subscription_id)

File urls/defaults.py

     (r'^flushcache/$', flush_cache),
     (r'^moderate/(approve|delete|spam|close)$', moderate),
     (r'^search$', search),
-    (r'^(.+?)/redirect/$', redirect),
+    (r'^(.+?)/redirect/(#.*)?$', redirect),
     (r'^(.+?)/comment/$', post),
     (r'^(.+?)/(m/)?$', post),
 )
         msg.attach_alternative(loader.render_to_string('email/moderator.dhtml', context), 'text/html')
         msg.send(fail_silently=False)
 
-        return http.HttpResponseRedirect('redirect/')
+        return http.HttpResponseRedirect('redirect/#%s' % comment.id)
 
     context = _defaults(request, context={
         'comments': document.comments(),