[Zope] Using DTML or Python in ZClass Properties?

Paul Erickson erickson@kaivo.com
Sat, 09 Mar 2002 13:11:47 -0700


Dan Shafer wrote:

> Thanks. I was afraid of that. Seems like a bit of an oversight but 
> I'll live with it.
>
> Dieter Maurer wrote:
>
>> Dan Shafer writes:
>> > I have a ZClass with a property that is a date. I would like that > 
>> property's value to contain the current date as a default, subject to 
>> > user override.
>> This is not possible (as you found out).
>>
>> The next thing you can come at it to set the date in your
>> Z instance constructor. Of course, it is then fixed at instance
>> creation time.
>>
>>
>> Dieter 
>

What about something like this, in your "yourZClass_add" method - 
assuming your property is called "mydate":

<dtml-unless name="mydate">
 <dtml-call expr="REQUEST.set('mydate', _.DateTime())">
</dtml-unless>

<dtml-call "propertysheets.Basic.manage_editProperties(REQUEST)">


Sorry if this isn't answering the question, I seemed to miss the 
original post.

-Paul