By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,626 Members | 2,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,626 IT Pros & Developers. It's quick & easy.

Handle Twisted LoginDenied Error

P: 1
I currently have a login page for a web app that raises a Twisted UnauthorizedLogin Error if the username or password is wrong.

I am trying to add to this a check to see if the account is enabled or disabled, and if disabled, raise a Twisted LoginDenied Error.

This part all works ok, I can see that the LoginDenied Error is being raised ok, but I have no idea how to handle the error. It is just going to a generic Python exception page showing the error and part of the traceback. I want to simply display a message below the password testbox, indicating that the account is disabled.

I have been looking at the code for the UnauthorizedLogin error, to try to emulate how it is handled, but I can't seem to make sense of it. It looks like it calls the Nevow function incorrectLoginError, which is in the SessionWrapper class in nevow.guard. That method appends 'login-failure' and 'Incorrect Login.' to the url, and then there is a nevow render method on the page which checks the url and shows an error label if it sees the 'login-failure' portion of the querystring. I am missing how this is all tied together though, because when I set a breakpoint in the incorrectLoginError method, it never seems to get called when the exception is raised. So, I have been unable to fully comprehend how the UnauthorizedLogin error is handled, and thus I cannot figure out how to go about handling the LoginDenied error.

If anyone has some advice for me I would appreciate it. I am new to Python and Twisted/Nevow, and it is all a bit confusing at first, coming from a .Net background.
Apr 5 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.