[albatross-users] impedance mismatch 1
Gregory Bond
gnb at itga.com.au
Wed Jul 2 10:44:13 EST 2003
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....)
More information about the Albatross-users
mailing list