[albatross-users] next bit of confused insight

Eric S. Johansson esj at harvee.org
Thu Sep 25 14:25:54 EST 2003


I'm experimenting with keeping the login code external from the application. 
I'm trying to invoke it external to the initial invocation of albatross and it 
seems to be working okay but am having problems getting back to the original page.

I have hardcoded the return page but it's giving me grieve.

Template traceback (most recent call last):

Traceback (most recent call last):
   File "/usr/lib/python2.2/site-packages/albatross/app.py", line 248, in run
     self.display_response(ctx)
   File "/usr/lib/python2.2/site-packages/albatross/app.py", line 459, in 
display_response
     obj = self.__page_objects[ctx.page]
KeyError: edit_config.py

the code that gives me this error is:

      context.set_page('edit_config.py')

and is found in the login's page_process

now I'm not fully clear on how everything works yet (obviously).  What I do in 
edit_config.py is

app = SimpleApp(base_url = 'edit_config.py',
                 template_path = '.',
                 start_page = 'edit_config',
                 secret = '-=-secret-=-'
                 )

# check for authentication
new_request = Request()

#should not return without proper authentication.
login.go_login(new_request)

app.register_page('edit_config',edit_configuration())

app.run(new_request)

then in login.go_login

def go_login(new_request):
     app = SimpleApp(base_url = 'login.py',
                     template_path = '.',
                     start_page = 'login',
                     secret = '-=-secret-=-'
                     )

     # check for authentication
     authentication = login_authentication()

     if hasattr(new_request,'_albatross_authentication') and \
        authentication.validate_token(context._albatross_authentication):
         # token is there and validates.  Return to calling context
         return

     syslog.syslog("let's go to authentication")
     #need to go off and do login authentication
     app.register_page('login',login_processing())
     app.run(new_request)
     sys.exit(0);

so, according to my limited knowledge, everything should work but obviously I'm 
missing something.  Ideas?  By the way, pushing the code around like this makes 
me even more convinced that some form of authentication should be embedded just 
to make it easier for people to do things right.

---eric





More information about the Albatross-users mailing list