[Zope] Default DTML in ZClasses
Alexander Staubo
alex@mop.no
Tue, 16 Nov 1999 23:21:46 +0100
I have a folderish ZClass containing objects, such as DTML Methods.
As it turns out, while those objects are attached to the class
definition, not the class instances, there is no way to _override_ those
objects by placing, say, a DTML Method in the instance with the same
name as that inside the class. (Instead, you must derive a new ZClass
from the first, and override them there.)
It seems that convention is to have the ZClass/product create "default
objects" upon construction. Confera, Squishdot, etc. all do this.
I wonder if there should be a standard way of doing creating such
default objects. I currently put objects in my ZClasses and name them
things like "TemplateFoo". Then the constructor for that class does
something like:
<dtml-let Obj="TodoFolder.createInObjectManager(REQUEST['id'],
REQUEST)">
<dtml-call "manage_addProduct['OFSP'].addDTMLMethod(Item, 'Foo',
file = Obj.TemplateFoo)">
</dtml-let>
...which copies TemplateFoo from the class into the newly created
instance. Of course, while this works, it feels kludgy.
Comments?
--
Alexander Staubo http://www.mop.no/~alex/
"Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former." --Albert Einstein