On Wed, Nov 19, 2008 at 7:28 AM, Raoul Snyman <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm attempting to upgrade my Pylons app to 0.9.7, but I can't seem to
> get past the "302 you will now be redirected" problem.
>
> What I did was I created a totally new Pylons app, and then I started
> moving my controllers and models and things across. I'm not sure if
> this is the best way, but I figured it was most probably the easiest.
> I also read through the "What's new in 0.9.7" document and the
> "Upgrading" document on the wiki, and followed directions as much as I
> could.
>
> I've left map.minimize on False, and I added the extra lines in my
> routes.py file as per the documentation. I also made sure that my
> middleware.py file had the necessary lines. I also modified base.py
> and the BaseController class, because my authentication system checks
> for a valid user in the __before__ function.
>
> Now the problem comes in that when I hit the main page, my default
> controller sees that there's no user logged in and tries to redirect
> me to the login page. Except it just sits there saying "302 Found The
> resource was found at http://localhost:5000/member/login/; you should
> be redirected automatically." and never redirects me.
>
> routes.py: http://codepad.org/d4lpLxas
> middleware.py: http://codepad.org/kdnRbRpl
> base.py: http://codepad.org/qIvkBnxK
>
> Any idea what am I doing wrong?

I have a similar authentication system in a Pylons 0.9.7 app so I can
verify it works.

Looking at your modules, I didn't know Routes had an .append_slash
option but that could be throwing it off.  There's no reason to put
slashes at the end of URLs except to make it look like a directory to
the user, but even then it's not necessary (/messages and
/messages/1234 work fine).

There's another redirect_to function in pylons.controllers.util which
you should be using instead, as routes.redirect_to is being phased
out.  But they should both behave the same.

You should be putting h.url_for() around all URLs, as that will adjust
the URL if it needs a prefix someday.  Or you can use Pylons 0.9.7's
fancy url() object (pylons.url), which will be its replacement in
Pylons 1.0.

You can turn on route debugging to see if it gives any clues.  Add
this to development.ini:

===
[logger_routes]
level = DEBUG
handlers =
qualname = routes.middleware
===

And add 'routes' to the 'keys' option in [loggers].

If none of these help, I would check your app under Live HTTP Headers
to see what it's actually doing.  The 302 response should have a
Location: header with the absolute URL to redirect to.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to