I'm using Zope 2.3.2 and created a ZClass. I wanted to add a (date) field as a standard property for the class. However, unlike the string properties, I had to include an actual date in the data field. It gave me an error when I tried to leave it blank. Does anyone know why you MUST include a non-null date in a date field of a ZClass? Cheers, Ron
"Ronald L. Chicheter" wrote:
I'm using Zope 2.3.2 and created a ZClass. I wanted to add a (date) field as a standard property for the class. However, unlike the string properties, I had to include an actual date in the data field. It gave me an error when I tried to leave it blank.
Does anyone know why you MUST include a non-null date in a date field of a ZClass?
Cheers,
Hi Ronald AFAIK, it is simply that an empty value is not considered as a valid date type, and you specified (or had to specify) a type of *date* for this property field. There are other data types for which an empty value is not valid, e.g. *int* or *float*. Maybe best is, to give it a default date of *January 1, 1970*. --Flynt--
"Ronald L. Chicheter" wrote:
Does anyone know why you MUST include a non-null date in a date field of a ZClass?
How about because taht's the way it works <vbg> Guess you really didn't need that did you Ron? Anyway, the work around that I use is to just include a default that I know is either far into the past or far into the future so it can be excluded easily. Then any time you instantiate that class you also have to include a default for any dates that you do not yet want to fill. I usually just use a hidden field in the form. IIRC, the my_date_property:ignore_empty doesn't work either. All in all, it's still better than using a string property and doing the conversions. -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
participants (3)
-
Flynt -
Ronald L. Chicheter -
Tim Cook