[Zope] [newbie] Property with <dtml-var> in it's value

Dieter Maurer dieter@handshake.de
Tue, 17 Apr 2001 22:19:08 +0200 (CEST)


Stefan Mallepell writes:
 > Was just a bit surprised and haven't found anything about this on zope.org
 > ....
 > 
 > Can anyone tell me how I can make that a <dtml-var xxxx> which is stored in
 > a Property of a ZClass instance, will be "processed" when I reference it in
 > a dtml method. The property is from type "text" and there is normal text in
 > front and after the dtml-var statement.
Did you already read the available documentation?
the Zope book and

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html


Never mind. If I understand you right, then you want to do
difficult things:

  Do you want to have something like a "computed property",
  say "title= 'What a great time <dtml-var ZopeTime>'"?
  This title would be different, each time it will be accessed
  because the time component would change.

  Properties are not designed for that!
  They are mappings of names to values of simple
  types: string, integer, lists, dates... nothing complex.

  The easiest way to emulate "computed" properties is
  to use a folderish ZClass that uses DTML objects
  or Python Scripts (External Methods) as property emulation.

  There are more difficult solutions that wrap convert property values
  into DTML objects and then render them....

Dieter