[albatross-users] Access to current/other page objects/modules

Andrew McNamara andrewm at object-craft.com.au
Fri Jan 24 10:37:40 EST 2003


>But I can't work out a way of doing this that has access to all the pieces 
>needed....  which (afaict) amounts to 
> - the current session (for substituting into descriptions)
> - the current page class object ("self" in page_display())
> - the list of page objects (hidden inside the current application object?)
>and is callable from the middle of a HTML template.

Could the PageBase class copy the relevent data from the subclass into
ctx.locals in the page_enter method? Something like (off the top of
my head):

    class PageDetails:
        def __init__(self, name, desc, nav):
            self.name = name
            self.desc = desc
            self.nav = nav

    class PageBase:
        def page_enter(ctx):
            details = PageDetails(self.name, self.nav_desc, self.nav_to)
            ctx.locals.page_details = details


-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/



More information about the Albatross-users mailing list