[Zope] DocumentTemplate Zen (QUEST)

Oscar Picasso picasso@videotron.ca
Wed, 15 Mar 2000 10:02:58 -0500


Hi everybody,

I'm struggling with some concepts in Zope. The last one is the
DocumentTemplate.HTMLFIle behavior. I was trying to run the Zen 'The (old)
Product API Tutorial' examples when I came accross with this line of code that
looked strange for me (maybe I don't know python enough):

index_html = DocumentTemplate.HTMLFile('poll2.dtml')
...
p = Poll("What's for breakfast?", ['spam', 'eggs', 'toast'])
print p.index_html(p)
------------------^^^

It worked fine and rendered my form.
But what looked strange to me was to give p as an argument. So I tried
p.index_html: it gave me the dtml file (with &lt; for < and so on).

So fine depending on whether or not you provide an argument the rendering is
different. I tried to read the sources to understand better that behavior.

I read somethings about passing mapping object or keywords arguments. But the
question is:
As p.index_html is a DocumentTemplate.HTMLFile instance why can we
provide it with arguments like if it were a method or if we were instantiating a
class?