Steve Alexander wrote:
The __call__ method is what gets invoked when you call the method, either through the magic of <dtml-var Catalog> or with <dtml-var "Catalog(client, namespace, args*)">.
Now you see, this is what confuses me... <dtml-var dtml_method> renders that method, implying in my mind that __call__ should render stuff adn return it. However, then with ZSearchable stuff, <dtml-var catalog> returns a list of all the objects in the catalog, or does a search if you poke it right. In my mind, __call__ is a bit ambiguous right now. I'd love to see objects have a __render__ method which gets called to render them, and leave the __call__ method when they're being specifically called.. Then I guess dtml would need <dtml-render adn <dtml-call instead of just <dtml-var I guess I'm in the minority when it comes to seeing this as a good thing? ;-) <snip protocols thing?
This mechanism is pretty much separate from the __call__ mechanism.
That's all cool, but not what was causing me confusion...
In conclusion, I can't see any disadvantage to making Folder callable as I suggested in a previous message. It doesn't appear to break anything :-)
I'd agree, since it doesn't make my confusion over __call__ any worse..
IIRC, ZRenderable lets you choose what method you want __call__ to forward to, whereas ZCallable always chooses the method index_html, if it exists.
Ah, so ZCallable is an inferior ZRenderable? *joke* :-)
You have to do something like <dtml-var "nameofafolder.index_html(_.None, _)">. But, that's not quite the same because if the folder lacks an index_html, it gets acquired.
But index_html will get acquired with that method too as folders do Implicit acquisiton, or am I missing something? Hmm, I think the patch is good, has anyoen subitted it yet? cheers, Chris