[Zope3-dev] Re: Field constructors

Garrett Smith garrett at mojave-corp.com
Tue Jan 13 16:31:20 EST 2004


Jim Fulton wrote:

> Philipp von Weitershausen wrote:
>  >>> 4. It'd be cool if you could use the standard schema field fields
>  >>> such as title and description instead of __doc__. This way, it'd be
>  >>> very easy to turn those schemas into web forms for local menus.
>  >>
>  >>
>  >> Sorry, you lost me on this one.
>  >
>  >
>  > Ah, well, it's not a big deal really. It's just that you write::
>  >
>  >            title = TextLine(
>  >                __doc__ =
>  >                """Menu item title
>  >
>  >                The title provides the basic label for the menu item.
>  >                """,
>  >                required=True.
>  >                )
>  >
>  > while I would prefer the schema convention::
>  >
>  >            title = TextLine(
>  >                title=u"Menu item title",
>  >                description=u"""The title provides the basic label
>  >                for the menu item.""",
>  >                required=True.
>  >                )
> 
> They are equivalent. I find the former more readable.  I'd actually
> prefer to be able to write:
> 
>            title = TextLine(
>                """Menu item title
> 
>                The title provides the basic label for the menu item.
>                """,
>                required=True.
>                )
> 
> This will require a change to the way field constructors are written. :/

Were this implemented, I assume we'd want to modify existing field 
declarations and standardize on the new convention. Would title and 
description attributes then be deprecated?

I strongly prefer the simple notation (i.e. without __doc__ or 
title/description). It's always bothered me that Attribute and Field 
declarations used different syntax, given their similarities.

  -- Garrett




More information about the Zope3-dev mailing list