[Zope] How to override DTMLFile? (solved)

Johan Carlsson johanc@easypublisher.com
Sat, 24 May 2003 10:34:03 +0200


Peter Bengtsson wrote:
> I got it!
> 
> class CTDTMLFile(DTMLFile):
>     def __init__(self, name, _prefix=None, **kw):
>         " doc string "
>         <do whatever needs to be done>
>         apply(DTMLFile.__init__, (self, name, _prefix), kw)
> 
>     def _exec(self, bound_data, args, kw):
>         " doc string "
>         zope = bound_data['context']
>         <do whatever needs to be done>
>         return apply(DTMLFile._exec, (self, bound_data, args, kw))
> 
> 
> The aim of this hack is for me to be able to control whether DTML 
> Methods should be run from the filesystem or as DTML Method objects.
> This will hopefully lead to a all-purpose product for whatever reasons 
> one might have.
> 

Cool, but what doe sit do?

I suspect the "zope = bound_data['context']" is to get
the current namespace for the "<do whatever needs to be done>" part in 
"_exec"?

What is the bound_data anyway?
And what is prefix?

Johan Carlsson