[albatross-users] Re: <al-lookup> thoughts

Dave Cole djc at object-craft.com.au
Thu Aug 15 13:00:01 EST 2002


>>>>> "Andrew" == Andrew McNamara <andrewm at object-craft.com.au> writes:

Andrew> I'm currently using an <al-lookup> table in the popview
Andrew> application when displaying mime messages - we look up the
Andrew> mime type to get to appropriate rendering method.

Andrew> The problem is, there are a bunch of mime types that share a
Andrew> common rendering method. I could have a dict that mapped from
Andrew> mime type to rendering method, but it would seem to be more
Andrew> sensible to have some way of representing this in the
Andrew> template.

Andrew> One thought that occured to me is that if the <al-item
Andrew> expr="..."> returned a list, we could add each list item to
Andrew> the lookup dictionary:

Andrew>    <al-item expr="['image/gif', 'image/jpeg', 'image/png']">
Andrew> ...  </al-item>

That would probably be a good thing.  The alternative is to have
presentation logic bleed into the application and have the MIME type
pre-evaluated inside the application so compress a list to a single
value.

Andrew> It might also be useful to be able to do things like this:

Andrew>    <al-lookup name="foo"> <al-item
Andrew> expr="foo.startswith('image/')"> ...

Andrew> We'll obviously have to iterate, rather than using a
Andrew> dictionary in cases like that. And my suggested syntax needs
Andrew> more thought.

I suppose that could be done by doing the static dictionary lookup
first then following up with an iteration of eval style options.  It
might be a good idea to explicitly distinguish between static and
dynamic expressions though (via different attribute).  Currently the
static "switch labels" are expressions which are evaluated and the
result is then placed into a dictionary.

- Dave

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




More information about the Albatross-users mailing list