[albatross-users] pushing and popping
Dave Cole
djc at object-craft.com.au
Fri Oct 3 15:14:05 EST 2003
> following some ofthe suggestions I received, I restructured how I'm
> handling login. for example:
>
> def login_validation(self,context):
>
> # check for authentication
> authentication = login_authentication()
>
> if hasattr(context,'_albatross_authentication') and \
> authentication.validate_token(context._albatross_authentication):
> # token is there and validates. Return to calling context
> return 1
>
> syslog.syslog("let's go to authentication")
> #need to go off and do login authentication
> context.push_page('login')
>
>
> Application.validate_request=login_validation
>
>
> overwrites Application.validate_request's method with my code
> login_validation. It's cool and that my code transfers controlled to
> my login page, I enter my username and password and then, on
> submission nothing happens except and error message telling me I
> have premature end of script headers. It's not clear what's going
> on because neither of my two display objects appear to get executed.
> I suspect I have some form of fault happening very early on and I am
> puzzling on how to get a handle on the error. Any suggestions?
> Running the script by hand at the command line and paying attention
> to network dumps aren't helping.
>
> On the other hand, maybe getting some sleep might help (up to early,
> up too late, Mars is beautiful and has been all this opposition).
Off the top of my head and completely untested...
def login_validation(self, ctx):
# check for authentication
authentication = login_authentication()
if (ctx.locals.__page__ == 'login'
or (hasattr(ctx,'_albatross_authentication')
and authentication.validate_token(ctx._albatross_authentication))):
# token is there and validates. Return to calling context
return 1
syslog.syslog("let's go to authentication")
# need to go off and do login authentication
ctx.push_page('login')
You need to process the browser requests that are made from the login
page.
- Dave
--
http://www.object-craft.com.au
More information about the Albatross-users
mailing list