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

Marcin Kasperski Marcin.Kasperski@softax.com.pl
Wed, 16 Aug 2000 09:01:55 +0200


[ I reply both to the author and Zope list, feel free to answer to the
list only ]

>  > 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".

What exactly should I write? Currently my constructor method contains
the following (mk_dtml_document is my custom class which subclasses DTML
Document, Extra is the name of my custom propertysheet):

<dtml-with "mk_dtml_document.createInObjectManager(REQUEST['id'],
REQUEST)">

  <dtml-call "propertysheets.Extra.manage_editProperties(REQUEST)">
  <dtml-comment> How can I change original title? </dtml-comment>
  <dtml-call reindex_object>

</dtml-with>

On which object (which property sheet) should I call
manage_editProperties to change document title?


> 
>  > 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.
> 

So it is impossible to use original DTML Document property screen? I
like it.


>  > 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.

Not exactly. I would like to have bodies of my DTML Documents and my
custom class (which does not subclass DTML Document) .body property
contents to be indexed with _the same_ full text index.

I tried defining method PrincipiaSearchSource in my custom class but it
did not helped (ZCatalog did not indexed my objects in PrincipiaSearch
index - according to its status screen).


>  > 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.

Yes I know. In fact I ask 'what can I do to parse DTML in a method of
object which does not subclass DTML Document?'

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

And that 'somehow' is what I am asking for.

> 
>  > 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.
> 

The archives are not searchable :-(
I will try downloading them but if anyone has this article handy, I'd be
grateful.

			Regards


-- Serwis nie tylko mieszkaniowy: http://www.mk.w.pl 
|
| Osoba jest omegalizacją ewolucji uniwersalnej na  określonym odcinku  
| etapowym (Teilhard de Chardin)                                        
|