[albatross-users] impedance mismatch 1
Matt Goodall
matt at pollenation.net
Wed Jul 2 10:54:35 EST 2003
Thanks for that correction! Now I understand globals as well :)
On Wed, 2003-07-02 at 01:44, Gregory Bond wrote:
> One wrinkle on all this:
>
> > * "environ" when inside the template refers to the same dictionary
> > as "ctx.locals.environ" in the python code.
>
> ... and if ctx.locals.environ doesn't exist, then it looks for environ in the
> global context of the _page display function_. So you can do something like:
>
> ----
> my_heading = 'Super Application'
>
> class StartPage:
> # ...
> def page_display(self, ctx):
> ctx.run_template('start.ht')
> ----
> then, inside start.ht, something like
> <h1><al-value expr="my_heading"/></h1>
> and it will work.
>
> But the trick is it uses the global namespace of the function that calls
> run_template(). If you use page modules, it has to be in the page module. If
> you do what I do and have a library with a base class for Albatross pages that
> has a run_template function, then you will get the global namespace of the
> library module, not the application, unless you override the page_display in
> your concrete page class.
>
> (Which is probably as clear as mud....)
>
>
>
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users
--
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net
More information about the Albatross-users
mailing list