[Zope-dev] HTMLFile() question

Martijn Faassen m.faassen@vet.uu.nl
Thu, 18 Nov 1999 19:57:35 +0100


Hi there,

In my Product code I do more or less the following:

..
from Globals import HTMLFile

form1 = HTMLFile('addForm', globals(), formname='form1')
form2 = HTMLFile('addForm', globals(), formname='form2')
form3 = HTMLFile('addForm', globals(), formname='form3')
..

addForm.dtml contains something like this:

..
The name of the form is:<dtml-var formname>
..

After this I register several product classes with Zope, product1,
product2 and product3 each given their own form (form1, form2 and form3)
as their addForm.

Now, upon trying to add product1, I'd like it to have 'form1' appear in
its addForm. But instead 'form3' appears, the HTMLFile that was created
last. This happens for form2 as well. Somehow all the earlier values are
forgotten.

Why does this happen? What am I doing wrong? Should I use globals() as
an argument here? What other arguments could work in its place? If I
don't use globals() but None instead, Zope won't find the addForm.dtml
file at all, looking for it in 'lib/python' for some reason. I suppose I
should dig more into the code, but could anybody enlighten me on what's
going on?

Regards,

Martijn