Re: looking at AT schema: (was) zope 3 schema's and the rest of us

Martin Aspeli <[email protected]> Fri, 14 Jul 2006 08:16:20 +0100
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
whit wrote:

> #class WikiField(ObjectField):
> #    """  my old field """
> 
> def WikiField(name, **kw):
>      """ my new field factory/registration function """
> 
> 
> consider what would be required to achieve parity in zcml (first, some at):
> 
> WikiField('text',
>             required=True,
>             searchable=True,
>             primary=True,
>             filters=('Wicked Filter',),
>             validators = ('isTidyHtmlWithCleanup',),
>             default_content_type = ATDOCUMENT_CONTENT_TYPE,
>             default_output_type = 'text/html',
>             allowable_content_types = ('text/structured',
>                                         'text/x-rst',
>                                         'text/html',
>                                         'text/plain',
>                                         'text/plain-pre',
>                                         'text/python-source',),
>             widget = atapi.RichWidget(
>                          description = "The body text of the document.",
>                          description_msgid = "help_body_text",
>                          label = "Body text",
>                          label_msgid = "label_body_text",
>                          rows = 25,
>                          i18n_domain = "plone"))
> 
> which does the same as:
> 
> <at:field
>     name='text'
>     provides='archetypes.field.IWickedfield'
>     required=True
>     searchable=True
>     primary=True
>     filters='archetypes.txtfilter.IWickedFilter'
>     validators ='archetypes.validators.IisTidyHtmlWithCleanup'
>     default_content_type = 'archetypes.content.interfaces.IDocument'
>     default_output_type = 'text/html'
>     allowable_content_types = 'text/structured,
>                                text/x-rst,
>                                text/html,
>                                text/plain,
>                                text/plain-pre,
>                                text/python-source'>
>    <at:widget
>       name='default'
>       provides='archetypes.widget.IRichWidget'
>       description = "The body text of the document.",
>       description_msgid = "help_body_text",
>       label = "Body text",
>       label_msgid = "label_body_text",
>       rows = 25,
>       i18n_domain = "plone" />
> 
> </at:field>

It seems a bit strange to me to move the schema definition to a ZCML 
file, when the Z3 parallel is a Python interface with attributes defined 
as instances of things in zope.schema. I'm not even sure how it's easier 
or preferable to defining Schemas the way we do them in AT now - it 
seems to be just a syntax transformation, no?

Martin



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642