This looks good, as did your earlier post. However, it raises a question

Something like a ZCatalog or a Squishdot Site (which I have a passing
interest in ;-) are both folderish. However, their __call__ method does
something quite different: it returns the results of searching the catalog
(I think this is the ZSearchable Interface, correct me if I'm wrong ;-)

I guess what's bothering me is why __call__ has this dual role and how the
rendering process manages to correctly render index_html even on a
Squishdot object which is actually callable?

Hmm... I guess the implication of this is that a normal folder will never
render itself to avoid confusion over the ZSearch interface and so if I
want this behaviour I'll have to roll-my-own folder which inherits from

Any ideas/comments?


PS: Shane: what's the difference between ZCallable and the ZRenderable
base class that Maik Roeder mentioned on [EMAIL PROTECTED] a few days back?

On Fri, 14 Jul 2000, Steve Alexander wrote:

> Chris,
> Related to your question earlier, have you seen Shane Hathaways' recent
> checkin into PTK?
> "Added the ZCallable product, which is a very simple base class that
> makes it possible to call an class instance directly."
> --------
> from ExtensionClass import Base
> class ZCallable (Base):
>     def __call__(self, *args, **kw):
>         '''Calls index_html, if it exists, to render this object.
>         '''
>         base = getattr(self, 'aq_base', self)
>         if hasattr(base, 'index_html'):
>             v = self.index_html
>             args = (self,) + tuple(args[1:])
>             return apply(v, args, kw)
>         else:
>             raise AttributeError, 'index_html'
> def initialize(context):
>     context.registerBaseClass(ZCallable)
> --------
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
> http://www.cat-box.net

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to