

def redirect_to(request, url, permanent=True, query_string=False, **kwargs):
    "\n    Redirect to a given URL.\n\n    The given url may contain dict-style string formatting, which will be\n    interpolated against the params in the URL.  For example, to redirect from\n    ``/foo/<id>/`` to ``/bar/<id>/``, you could use the following URLconf::\n\n        urlpatterns = patterns('',\n            ('^foo/(?P<id>\\d+)/$', 'django.views.generic.simple.redirect_to', {'url' : '/bar/%(id)s/'}),\n        )\n\n    If the given url is ``None``, a HttpResponseGone (410) will be issued.\n\n    If the ``permanent`` argument is False, then the response will have a 302\n    HTTP status code. Otherwise, the status code will be 301.\n\n    If the ``query_string`` argument is True, then the GET query string\n    from the request is appended to the URL.\n\n    "
    args = request.META.get('QUERY_STRING', '')
    if (url is not None):
        if kwargs:
            url = (url % kwargs)
        if (args and query_string):
            url = ('%s?%s' % (url, args))
        klass = ((permanent and HttpResponsePermanentRedirect) or HttpResponseRedirect)
        return klass(url)
    else:
        logger.warning('Gone: %s', request.path, extra={
            'status_code': 410,
            'request': request,
        })
        return HttpResponseGone()

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/views/generic/simple.py redirect_to/original