durusmail: quixote-users: request.redirects in _q_lookup
request.redirects in _q_lookup
2003-06-07
request.redirects in _q_lookup
Mark Bucciarelli
2003-06-07
I want my top-level _q_lookup to redirect all invalid requests to the
login form.

This redirects  :       http://localhost/a
but not this    :       http://localhost/a/

My _q_lookup looks like this:

    if not request.session.user or request.session.user != name:
        url = 'http://%s/login' % request.get_server()
        print '  redirect to login form at', url
        return request.redirect(url)
    else:
        print '  create user interface'
        return user.Interface(request, name)

It looks to me (seee TraversalError below) like quixote is treating
the login form HTML as an object and attempting to traverse it.  Is
there a way to short-circuit the traverse and force quixote to honor
the redirect?

I want the url to read "/login", as it is part of the ui.

More details ...

The debug output is this:

case 1: http://pooh:8000/a
-----------------------------------------------------------------
__init__._q_lookup, name= a user= None
  redirect to login form at http://pooh:8000/login
LoginForm.__init__

case 2: http://pooh:8000/a/
-----------------------------------------------------------------
__init__._q_lookup, name= a user= None
  redirect to login form at http://pooh:8000/login
__init__._q_exception_handler
  url  =  http://pooh:8000/a/
  path =  /a/
server =  pooh:8000

Here's the publishing error text:

 ('\n
Redirect to http://pooh:8000/login\n
\n 

Redirect

\n

Your browser should have redirected you to\n

http://pooh:8000/login
\n

\n \n\n' has no _q_exports list). -- Mark Bucciarelli, www.hubcapconsulting.com He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine receives light without darkening me. -- Thomas Jefferson
reply