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

Dieter Maurer dieter@handshake.de
Tue, 15 Aug 2000 11:09:30 +0200 (CEST)


Marcin Kasperski writes:
 > I decided to subclass DTML Document and (using ZClass) create my own
 > document class ....
 > 
 > 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.
Your ZClass inherits the methods of its base classes.
You use the base classes methods to access their features.

In your specific case, you would use "manage_changeProperties"
to change the DTML Document properties.
"manage_changeProperties" is defined by "OFS.PropertyManager.PropertyManager".

 > 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?
You can create your own ZClass "view" that does this.

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

 > 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 just define "Meta Data" or indexes for them.

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

  "index_html" has nothing to do with interpreting DTML tags.

  If there is an "index_html", then, via the web, you
  can use ".../my_object" and, in fact, ".../my_object/index_html"
  is used. That is all.

  When you want to interpret DTML tags, you will need to somehow
  use DocumentTemplate instances.

 > And one question after the whole mess. I migrated my (fairly small so
 > far) website from DTML Documents to my custom document class - and I did
 > it manually. But I would not like to perform similar operation manually
 > if the site contained 500 or 5000 pages. 
You will find in the list's archive a suggestion for converting
DTML documents into DTML methods.
It could be adapted for your purpose.

You may have a look at ZPublisher.Client, too.
It allows to control Zope by external Python scripts.


Dieter