[Zope] DTMLFile question

tomas@fabula.de tomas@fabula.de
Thu, 22 Aug 2002 13:57:51 +0200


On Thu, Aug 22, 2002 at 09:11:19AM +0200, Andreas Kostyrka wrote:
> Am Die, 2002-08-13 um 21.15 schrieb tomas@fabula.de:
> > Now I'd like to be lazy and try to fetch the views `as needed',
> > instead of declaring them as DTML class methods. Is that possible?
> It is ;) That's how one usually does it with a
> "ZPublisher+ZDocumentTemplate" app :)
> > 
> > What I have in mind is a method
> > 
> >   |class CMSResource( Traversable.Traversable, ...)
> >   |    "Yadda, yadda"
> >   |
> >   |    ...
> >   |
> >   |    def render(name, args):
> >   |      my d = DTMLFile("dtml/CMSResource/" + name)
> >   |      return <<call d with appropriate arguments>>
> Well, either this is not your actual code, but it lacks self, OTOH

It does. This was one of my first attempts.

> my d seems perlish to me.

It is (*blush*)

> If you do something like this:
> return d(...)
> 
> you will get back the rendered HTML, not a DTMLFile object.
> 
> Basically, if you'd post your real method code, we might help you.

I snipped down the code to the bare minimum to strip it off unnecessary
obfuscation. In the process it seems that some bits of my perl self
slipped in... ;-)

I'll get back to it soonish. I got distracted with another little fire
in the project which is more urgent right now. But lurking a bit on
this list already provided me with some ideas. Gimme two or three
days...

Thanks
-- tomas