>From: Chris Withers [mailto:[EMAIL PROTECTED]]

I got this answer to my question about how to render a dtml document from a
method.

>testisDocTemp = 1
>def test(self,ignored,md):
>    " A simple test method "
>    return HTMLFile('skins/' + self.skin, globals())(None,md)

And I have been busy trying to read the source code to understand the
advise:

As far as I understand the story goes a little like this:

HTMLFile returns an object (through inheritance) "String" in file
"DT_String.py" that has "__call__()" implemented, which means that the class
can be called as a function... Hmm ... I had actually not seen this method
used in Python before.

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

>def test(self,ignored,md):

Furthermore I dont understand what md is. Some kind of mapping object
naturally, but where does it come from?

Also what is testisDocTemp supposed to do?

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

Regards Max M

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

Reply via email to