[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/src/zope/schema/tests - test_datetime.py:1.3 test_floatfield.py:1.3 test_intfield.py:1.3 test_strfield.py:1.3

Martijn Faassen faassen@vet.uu.nl
Tue, 15 Apr 2003 20:41:55 +0200


Steve Alexander wrote:
> I was going to make a similar change to this field type.
> However, rather than make a different implementation class, I was going 
> to use the same implementation class, and have instances change their 
> own interface declaration depending on whether allowed_values is defined.
> 
> This allows you to use a different widget for an any-values fields to 
> the one used for an allowed-values field.

I like that approach; it can be very powerful. Of course before
interfacegeddon actually spelling that out in code is messy, but 
after interfacegeddon there will be a method you can define on your
class to explicitly do this, as well as an easier way to specify 
interfaces for instances, so then that will be a clean technique.

I prefer this approach to multiplying fields.

Regards,

Martijn