[Zope] Can't add "date" property to new ZClass
Kevin Dangoor
kid@kendermedia.com
Tue, 12 Oct 1999 14:32:48 -0400
-----Original Message-----
From: Loren Stafford <lstafford@icompression.com>
To: Kevin Dangoor <kid@kendermedia.com>; Dr. Ross Lazarus
<rossl@med.usyd.edu.au>
Cc: zope@zope.org <zope@zope.org>
Date: Tuesday, October 12, 1999 2:29 PM
Subject: RE: [Zope] Can't add "date" property to new ZClass
>You've just written (below) most of a "How-To: Properties in ZClasses"
which
>is clearer than anything else I've seen to date. Do you mind if I expand it
>into a formal "How-To"?
Be my guest. I've been too swamped to finish off all of the things I've got
floating around in my head to do.
>There's just a couple more things I don't understand, but would want to
>explain in a How-To document:
>
>1. A ZClass can have more than one property sheet. But why would you want
to
>use that capability? Different permissions? Displayed under different
>circumstances? ...? ...examples?
I haven't need multiple propertysheets myself, but security definitely seems
like one possible application. Let's say you have an object that has a
"public" part and a "private" part. You could use a different permission for
the "private" part so that only certain people could manipulate those
properties.
>2. When instantiating a ZClass, the Factory errors if the properties are
not
>defined. Should it do that? Shouldn't it handle undefined properties? (Is
>that what Michel meant when he wrote "In fact, [Zope] should be smarter for
>instances also and just assume a sane value (like calling DateTime() with
no
>arguments, which returns 'now')."
Yes, I think that was what Michel was saying could be handled a little
smarter. Basically, your ZClass_add method needs to ensure that dates,
floats and ints all have legal values. (There might be other data types that
require a legal value, but those are the three I know off hand).
Kevin