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

2000-08-16 Thread Dieter Maurer

Marcin Kasperski writes:
 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? 
  On which object (which property sheet) should I call
  manage_editProperties to change document title?
On the object you want the title changed 

Okay, let's admit: I am a bit confused.

  Above, I understood that your class derives from DTML Document.
  Then each instance of your class is an instance of DTML Document, too.
  You use the inherited methods in the same way you use the methods
  defined in your class.
  I.e. 

dtml-with mkNewObject(.)
   dtml-call "manage_changeProperties(.)"
/dtml-with

  What confuses me: below your custom class does not seem to
  be derived from 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?
   You can create your own ZClass "view" that does this.
  
  So it is impossible to use original DTML Document property screen? I
  like it.
You can use the source and extend it (slightly).


 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.
What should this "the same" mean?

  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).
Any parameterless method (or any attribute) should work.

Maybe, your methods throws an exception. Then, it will not contribute
to the indexing. Test it in isolation.
 

 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.
You either use the Zope wrapped Document Template objects
(DTML method/document) or you use the DocumentTemplate
directly in Python (external method, product, maybe Python method).

The DTML user guide contains a chapter on how to use Document Template
from Python.

 
  The archives are not searchable :-(
You look at the wrong archives.

NIP archives the main Zope mailing lists.
*These* archives *are* searchable.



Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




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

2000-08-16 Thread R. David Murray

On Wed, 16 Aug 2000, Marcin Kasperski wrote:
 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?

I believe the title goes in the 'default' property sheet, but more
than that I can't tell you.  'default' gets some special handling
I think, but you could certainly try just using it in place of
Extra in the call up there.

--RDM


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




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

2000-08-15 Thread Dieter Maurer

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

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )