Maciej Wisniowski schrieb:
I have this interface:

class INews(IPage):
    """A news page for the application.

    date = Date(
        title=_(u"Publication Date"),
        description=_(u"The intended date for this news"),,
With formlib (in Five in fact, not with Zope3) I was creating
form_fields that should have dynamic defaults in __call__
method of formlib's AddForm (EditForm)
view. I think it is not nice solution so I'd love to see
better way of doing this.

How about checking whether the value of 'default' is a
callable and if so call it to obtain the default value.
That way

(without the ())should do what Douglas expects (maybe
this is even the case already?).

Not that you want to know this but in Archetypes we explicitly
support 'default' and 'default_method' as field properties.
If no 'default' is provided, 'default_method' is looked up and
if it exists it's called.


Zope3-users mailing list

Reply via email to