[Zope3-dev] Re: Field constructors

Philipp von Weitershausen philipp at weitershausen.de
Wed Jan 14 10:53:02 EST 2004


Jim Fulton wrote:
>  > 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 see the majyck in Field.__init__ now. I'm repelled and attracted at 
the same time. :)

> I find the former more readable.

Whatever happened to explicit is better than implicit? People will ask: 
why that magic? (see i18n issue below).

> 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. :/

I'm ok with that. The i18n issue remains, though. And I wouldn't want to 
sell a newbie that the Field constructor automatically splits the 
__doc__ and makes message ids out of the title and description. What 
domain will it make them for? It'll make the extractor tool a lot more 
complicated as well.
Maybe I'm overseeing something, but I don't think it'll make our lives 
easier, especially when it's just a cosmetic thing.

Philipp





More information about the Zope3-dev mailing list