[Zope] DTMLFile, the mysterious animal

Oliver Bleutgen myzope@gmx.net
Tue, 20 Aug 2002 11:59:41 +0200


Casey Duncan wrote:
> DTMLFile is a class, and is generally instantiated at import time. Passing 
> arguments to the class constructor (filter='Image') doesn't affect the 
> execution of the instance itself (the dtml code).
> 
> To pass arguments to the instance, you do so when you actually call it. If its 
> being called from the web (a likely thing), then you can pass arguments on 
> the query string (?filter=Image). If you cannot do this, then you must wrap 
> the dtml file call in another method that supplies the arguments, something 
> like:
> 
> main_dtml = DTMLFile('www/main.dtml', globals())
> 
> def main(self, context, REQUEST, **kw):
>   kw['filter'] = 'Image'
>   return self.main_dtml(context, REQUEST, **kw)
> 
> hth,
> 
> -Casey

Many thanks Casey,

I see it was a quite dumb mistake, what confused me was that apparently 
I managed to create a situation where objectItems wasn't callable 
anymore (as the error told me). Anyway, now it works, thanks again.


cheers,
oliver