> I'm uncomfortable with this. Right now, I think fields do too much.
> They have too much application logic. This would add more. The whole
> concept of "initial value" seems to be very application dependent.
> Maybe it would be best to just drop the default field altogether
> and introduce adapters for computing initial values in those special
> cases when we need them.
Funnily, I just faced this dilema earlier today. I nearly created an interface
like this:
class IInitialValue(Interface):
"""An interface for obtaining an initial value for an object."""
def get():
"""Returns the initial value."""
IMO, this is superior to field.initial. E.g.
zapi.getMultiAdapter((field, context), IInitialValue).get()
Perhaps this pattern could be used for getting an ISource from a field. E.g.
zapi.getMultiAdapter((field, context), ISource)
-- Garrett
_______________________________________________
Zope3-dev mailing list
[email protected]
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com