def login_url(login_view, next_url=None, next_field='next'):
 base = expand_login_view(login_view)
 if (next_url is None):
  return base
 parts = list(urlparse(base))
 md = url_decode(parts[4])
 md[next_field] = make_next_param(base, next_url)
 parts[4] = url_encode(md, sort=True)
 return urlunparse(parts)

def login_url ( login_view , next_url = None , next_field = 'next' ) : base = expand_login_view ( login_view ) if ( next_url is None ) : return base parts = list ( urlparse ( base ) ) md = url_decode ( parts [ 4 ] ) md [ next_field ] = make_next_param ( base , next_url ) parts [ 4 ] = url_encode ( md , sort = True ) return urlunparse ( parts )
creates a url for redirecting to a login page .