Mike Fletcher wrote:
It is often necessary to have slightly more complex data types on your Z-Class-like products. For instance, in my current project, I need t be able to set VRML-style vectors (particularly colors and three-element float vectors).
I think it would be better to develop objects like this in Python. There is no clear benefit to using ZClasses for this. There is a clear benefit in using a ZClass to provide a user interface and subclasses a very specialized Python class that does all the heavy lifting.
Zope allows for creating converters fairly easily, so that you can register code for interpreting data types. However, Zope handles the creation of input fields for property pages through a hard-coded if/elif/else mechanism in OFS/properties.dtml . The result is that your non-standard datatype shows up as "Unrecognized field type" and will not be part of the form when submitted (which will often cause logic errors if (as is likely) it is a required property).
Of course, it is possible to create custom manage documents for each property page which has more advanced data types, but this almost completely obviates the value of using property pages (i.e. automatic management of property sets such that the programmer need not even consider the management interface).
That's right.
As of yet, I don't see a clean way of fixing this problem other than re-writing properties.dtml to call out to an extensible mechanism for generating edit fields. To make this ideal, you would allow, for instance, dropping in a more advanced date editor (such as a calendar) to replace the default text-field version, or allowing for "object" fields where you can paste or create generic objects etc. If I do this work (at least the basic mechanisms, if not the ideal ones), would Digital Creations be willing to incorporate the changes?
Yes.
I am currently developing on 2.1.4, but can upgrade if there have been any changes in this area.
Yes.
If not, are there any suggestions on other means to accomplish the same ends (complex property data types)?
Doing this right would require some deep discussion. I suggest creating a Wiki on the zope site and soliciting comments. You may want to review the Interfaces Wiki first, particulary some very recent documentation written by Brian Lloyd. http://www.zope.org/Members/michel/Projects/Interfaces/Properties Let us know how useful this documentation is for you. -Michel