[Zope-dev] Problems subclassing DTMLDocument and DTMLMethod

Itamar Shtull-Trauring itamars@ibm.net
Thu, 24 Feb 2000 13:23:08 +0200


I've decided to rewrite ZCache in an OO way, so I rewrote it and called it
GenericCache.  First thing I'm trying to make are cached  DTMLDocument and
DTMLMethod.  GenericCache provides a Cache class that wraps all access to
the object, and if the cache expires Cache reloads its data.  How it reloads
is determined by overloadng a _getData method in subclasses.  So in a
subclass of Cache and DTMLMethod _getData would call DTMLMethod.__call__,
i.e. te cache would contain the rendered DTML.

I subclass Cached DTMLDocument from Cache and DTMLDocument, Cached Method
from Cache and DTMLMethod.  I have two major problems:

1.  The DTML only renders if I put all of it inside a <dtml-with
"PARENTS[0]"></dtml-with>, otherwise it doesn't seem to acquire anything. 
Cache inherits from Acquisition.Implict and of course so does DTMLMethod -
so why isn't acquisition working?

2.  The Cached DTMLMethod behaves just like a DTMLDocument - possibley
because of the above problem and/or my temporary solution.  That is, it
doesn't act as a method of the enclosing folder but as standalone object.

I'd be very grateful if anybody could point me in the right direction - I
put up the code at  http://www.zope.org/Members/itamar/GenericCache

-- 
The SNAFU Principle: True communication is possible only between equals

                      Itamar S.T.  itamars@ibm.net