[Zope3-dev] Proposed widget/schema work for the Rivah
sprint (Thursday and Friday this week)
Garrett Smith
garrett at mojave-corp.com
Mon Aug 29 18:21:00 EDT 2005
> 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
More information about the Zope3-dev
mailing list