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

Andrew McNamara andrewm at object-craft.com.au
Mon Dec 16 11:51:23 EST 2002


>>Try this patch (untested):
>
>Alas, doesn't seem to be quite right.....
>
>  File "/usr/local/lib/python2.1/site-packages/albatross/template.py", line 150, in to_html
>    item.to_html(ctx)
>  File "/usr/local/lib/python2.1/site-packages/albatross/tags.py", line 992, in to_html
>    lookup.lookup_html(ctx, value)
>  File "/usr/local/lib/python2.1/site-packages/albatross/tags.py", line 1045, in lookup_html
>    item = self.item_dict.get(value, self.content)
>AttributeError: Lookup instance has no attribute 'item_dict'

Ah - I think I see what you're doing - it's slightly different to my
macro problem (and maybe macro's have the same bug). For my problem,
I simply needed to know what resources were provided by a template
(what macros it defined).

In your case, you're defining a lookup after you're using it. It's not
immediately obvious how I can make this work - the Lookup tag needs to
know it's content. Hmmm -  I could probably move the item_dict creation
machinery from to_html to the first call of lookup_html. This will have
to wait till I have more time (or you can try it yourself).

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



More information about the Albatross-users mailing list