[albatross-users] load_template vs run_template, macros vs lookups

Dave Cole djc at object-craft.com.au
Wed Dec 18 16:18:41 EST 2002


> > In your case, you're defining a lookup after you're using it. 
> Hmm, I don't think so.  At least, I'm not deliberately doing this!
> 
> My App class does this:
> 
>     def create_context(self):
>         ctx = AppContext(self)
> 	ctx.load_template('header.html')	
> 	return ctx
> 
> 'header.html' contains a bunch of <al-macro> definitions, and some
> <al-lookup> definitions.  So the macros and lookups should be
> defined before more-or-less anything else happens.
> 
> Then in the page_display, I run_template() a file that uses these
> macros and lookups.  The macros work, the lookups don't.
> 
> If I change the create_context() to do
> 	ctx.run_template('header.html')
> then both the macros and lookups work.  This is (cough) non-intuitive.

The way it works is non-intuitive but useful.  Definitely an area
where the documentation could be improved :-)

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list