[Zope] Best way to subclass DTML Document and some other ZClasses questions

R. David Murray bitz@bitdance.com
Tue, 15 Aug 2000 01:26:34 -0400 (EDT)


On Mon, 14 Aug 2000, Marcin Kasperski wrote:
> 1) How can I set standard DTML Document properties (title!) from my
> constructor? I created constructor form and constructor method, I
> succesfully prompt for and set all my properties but I do not know how
> to set properties belonging to DTML Document.

Pass it as an argument to the call that creates the DTML Document.

> 2) Can I do anything to have single property screen which would behave
> as original DTML Document property screen but present both original
> properties and properties belonging to my custom property sheet?

Yep.  You should be able to replicate everything the original
constructor code does in your own code.  Read The Source, Luke <grin>.

> 3) Can I influence property editing screens (what I want is to increase
> some edit boxes)?

As far as I know (until Martjin finishes his skinnable support) you
can only do that by wholesale replacing the editing screen with
your own form.  Or by modifying the source.

> I created also some classes which do not inherit DTML Document or DTM
> method. I have questions about such a configuration:
> 
> 4) Can I do something to have ZCatalog PrincipiaSearch (i.e. full text
> search) to scan some property of my custom ZClass (say property body
> from propertysheet Basic)?

You can add that property name as an index, and construct your
search form so the search string is submitted to it (see the Advanced
ZCatalog Searching HowTo).  Or, you could define your own
PrincipiaSearchSource method and return whatever value is appropriate.
I *think* you should be able to define this as a method of your
ZClass, but I've never tried that.  I know it works from python <grin>.

> 5) Can I write index_html method of my custom class so it interpret DTML
> tags (like dtml-var substitution)?

I'm sure you can, but I don't know how <grin>.  But if you are doing
that, why not just subclass DTML-Method (or document)? 

> 6) What you, Zope gurus, would do if you were to find all the DTML
> Documents in some directory tree and remove them, creating instead XXXX
> Documents (where XXXX Document is some subclass of DTML Document) - and
> keeping the document id, title, contents and properties without change? 

Write an external method to do all the object creation, property
copying, and old object deletion.

> 7) And what if you were to change something a little - say detect that
> some property belongs to custom propertysheet and put it there instead
> on putting on standard DTML Document propertysheet?

Easy to do in external method python code.

> Regards and thanks in advance for any hints and references

I think my answers are a little bit too cryptic to be immediately
useful.  Maybe someone else will give specifics, otherwise I
hope they serve as useful hints.

--RDM