def ask_openid(request, openid_url, callback_url, redirect_to, user = None): """Функция формирования запроса к серверу в соответствии со спецификацией """ use_ax, use_sreg = discover_extensions(openid_url) return_to = "%s%s?%s" % ( get_url_host(request), callback_url, urllib.urlencode({REDIRECT_FIELD_NAME: urlquote(redirect_to)}) ) trust_root = getattr(settings, 'OPENID_TRUST_ROOT', get_url_host(request) + '/') consumer = Consumer(request.session, DjangoOpenIDStore()) try: auth_request = consumer.begin(openid_url) except DiscoveryFailure, e: return failure(request, e)
def xrdf(request): url_host = get_url_host(request) return_to = [ "%s%s" % (url_host, reverse('oid_complete_signin')) ] return { 'return_to': return_to }