[Grok-dev] Re: Fields inner class support removed in branch
Luciano Ramalho
luciano at ramalho.org
Thu Sep 13 13:59:33 EDT 2007
Thanks for this, Jan!
I will add this idiom to the doctests.
Regards,
Luciano
On 9/13/07, Jan-Wijbrand Kolman <janwijbrand at gmail.com> wrote:
> Zope already has a way of doing this:
>
> from zope.interface import Interface, implements
> from zope import schema
> from zope.schema.fieldproperty import FieldProperty
>
> class IMammoth(Interface):
> name = schema.TextLine(title=u"Name")
> size = schema.TextLine(title=u"Size", default=u"Quite normal")
>
> class Mammoth(grok.Model):
> implements(IMammoth)
> name = FieldProperty(IMammoth['name'])
> size = FieldProperty(IMammoth['size'])
More information about the Grok-dev
mailing list