[Zope] - can't __call__ objects?
Amos Latteier
amos@aracnet.com
Fri, 18 Dec 1998 12:01:08 -0800
At 02:17 PM 12/18/98 -0500, Skip Montanaro wrote:
>
>I'm experimenting with ZPublisher directly, since I think it will fit my
>needs better than full-blown Zope.
>
>If I have a class with a __call__ method, ZPublisher won't let me call the
>instance. I realize __call__ violates the "no underscore" publishing rule,
>but if an object is an instance and is otherwise publishable, shouldn't
>__call__ be called (no pun)?
Bobo^H^H^H^HZPublisher call's an object's 'index_html' method, if no method
is specified.
So if you want your __call__ method to be considered the default published
method here's how to do it:
class CallMe:
"defines __call__ as the default publishing method"
def __call__(self):
"call the object"
...
index_html=__call__
Pretty simple.
-Amos