[Zope] [ZGotW] Issue #1 Entry

Jeff K. Hoffman jeff@goingv.com
Fri, 21 Jan 2000 11:44:46 -0500 (EST)


On 2000 xxx -1, Zope Guru of the Week wrote:

> This can more concisely be written as
> <dtml-var "table_of_type(target, _, type_list = ['FooType'])">. 
> Specifying the client like this is a little-appreciated compensation for
> having to make the first two arguments explicit when passing keyword
> arguments.

Ahh, cool! I was getting ready to go dig into the code and see what kind
of flexibility I could get from that first argument, but you saved me the
time. Thanks!

> This can also be used to get around acquisition problems.  Suppose you
> don't want to clutter up your root folder with this sort of factored
> method, so you stick them all in a folder called '/lib'.  Now you want
> to call '/lib/table_of_type' on folder 'target'.  If you try...
> 
> <dtml-with target><dtml-with lib><dtml-var ...></...></...>
> 
> ..you'll get a list of object in 'lib' instead of 'target'.  Reverse
> the 'dtml-with's and it may work, but it's awkward, and fails if there
> is a '/lib/target'.  On the other hand...
> 
> <dtml-var "lib.table_of_type(target, _, type_list='Folder')">
> 
> ..will work just fine (even if table_of_type is a Document instead of a
> Method!).

This makes perfect sense, and is going to save me a lot of headache on the
project I'm working on. Woohoo! :)

> Cheers,
> 
> Evan @ 4-am
> 
> P.S.  I *really* like this Zope Guru of the Week idea.  This could turn
>       into a real Zope knowledge base.

I agree! Kudos to Tres and anyone else involved. And thanks to Evan for
the pointers on my submission.

--Jeff

PS. If I can get the formatting right, next time... :)

---
Jeff K. Hoffman                                         704.849.0731 x108
Chief Technology Officer                                mailto:jeff@goingv.com
Going Virtual, L.L.C.                                   http://www.goingv.com/