############################################################################### # Copyright (c) 2011 Linaro # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################### from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.utils.http import urlquote def handy_urls(request): path = urlquote(request.get_full_path()) root = '%s/index' % (settings.PREFIX,) login_url = '%s?%s=%s' % (settings.LOGIN_URL, REDIRECT_FIELD_NAME, path) logout_url = '%s?%s=%s' % (settings.LOGOUT_URL, REDIRECT_FIELD_NAME, root) return { 'login_url': login_url, 'logout_url': logout_url, 'root': root, }