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

Andrew McNamara andrewm at object-craft.com.au
Mon Dec 16 12:28:58 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.

Ah - okay - similar scenario: the *contents* of the lookup are only
registered at run time (the short patch I mailed only addressed the
registering of the lookup name, not it's contents). Something like I
mentioned in my previous message should work (but I don't have time to
check right now).

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



More information about the Albatross-users mailing list