Add a redirectLegacyRequest response
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 25 Oct 2009 15:39:50 -0700
changeset 3045 b6b5ad155dd9
parent 3044 7c63279401af
child 3046 cd08e035ac9e
Add a redirectLegacyRequest response
app/soc/views/helper/responses.py
--- a/app/soc/views/helper/responses.py	Sun Oct 25 15:39:38 2009 -0700
+++ b/app/soc/views/helper/responses.py	Sun Oct 25 15:39:50 2009 -0700
@@ -208,3 +208,15 @@
 
   return respond(request, sibling_templates, context=context,
                  response_args=error.response_args)
+
+
+def redirectLegacyRequest(request, *args, **kwargs):
+  """Redirects a request to a legacy url to the new '/gsoc' suffix.
+
+  Args:
+    request: a Django HTTP request
+  """
+
+  url = '/gsoc' + request.path
+
+  return http.HttpResponseRedirect(url)