[Zope] How to render a HTMLFile in a method in a product

Chris Withers chrisw@nipltd.com
Mon, 06 Nov 2000 12:28:03 +0000


Max Møller Rasmussen wrote:

> def __call__(self,client=None,mapping={},**kw):
> 
> This method accepts an object in which it will look up values to insert in
> the dtml file, and a mapping object (dictionary) that also will look up
> values to insert.
> 
> So i guess that is what (None,md) does.
> 
> But I dont understand what "ignored" does in  my method, as it is unused,
> unless it is used by md

Nope, ignored is the client, which you don't need to worry about.

> >def test(self,ignored,md):
> 
> Furthermore I dont understand what md is. Some kind of mapping object
> naturally, but where does it come from?

pDocumentTemplate.py has one implementation of it.

it's a stack of dictionaries, basically... When you do md['key'], it
looks for key in the top dictionary, then in the next one down, then in
the one below that, etc, and only throws a key error if one can't be
found at all...

> Also what is testisDocTemp supposed to do?

This is a bit of ExtensionClass wierdness. Think of it has "give the
test object the 'isDocTemp' attribute".

> If I grep the source a "isDocTemp" shows up but is isn't easy to see what
> this does either.

If some arcane bit of Zope's calling machinery finds this (probably in
BaseRequest.py) it sends different parameters to __call__.

HTH,

Chris