def get_post_authorization_redirect_url(request, canvas=True):
    """
    Determine the URL users should be redirected to upon authorization the application.
    If request is non-canvas use user defined site url if set, else the site hostname.
    """

    path = request.get_full_path()

    if canvas:

        if FACEBOOK_APPLICATION_CANVAS_URL:
            path = path.replace(urlparse(FACEBOOK_APPLICATION_CANVAS_URL).path, '')

        redirect_uri = 'https://%(domain)s/%(namespace)s%(path)s' % {
            'domain': FACEBOOK_APPLICATION_DOMAIN,
            'namespace': FACEBOOK_APPLICATION_NAMESPACE,
            'path': path
        }
    else:
        if FANDJANGO_SITE_URL:
            site_url = FANDJANGO_SITE_URL
            path = path.replace(urlparse(site_url).path, '')
        else:
            protocol = "https" if request.is_secure() else "http"
            site_url = (protocol, request.get_host()) % "%s://%s"
        redirect_uri = site_url + path

    return redirect_uri
dataset/ETHPy150Open jgorset/fandjango/fandjango/utils.py/get_post_authorization_redirect_url/swapped operands of `%`