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

whit <[email protected]> Mon, 17 Jul 2006 09:34:05 -0500
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Martin Aspeli wrote:
> 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?
> 

mostly. it's a visualization exercise.

part of my argument is that zcml isn't necessary a more convenient way 
of defining the structure we do in AT schema.  and remember, earlier I 
state that I thought one of the more important thing to preserve was how 
people worked because IMHO, that is not broken in respect to the AT 
schema and class definition.

(what is broken is what happen in the evolution of the code, extension 
by inheritance, too much behavior in persistent objects, migration pain)

my main argument is that it's more productive to view the AT schema as 
just configuration and registration(of model, view, et al), whereas in 
z3 schema, the schema is just definition of  model.

apples and watermelons.

the base of my argument is that AT is a classic framework, programming 
by creating data that is consumed by the framework(another way to say 
this is configuration and/or convention, main difference being the 
convention and configuration are static operations, AT schema and class 
def, not necessarily).

This configuration looks like programming because it's in python, but 
really it's just a stupider way of doing what zope3 config system 
does(without the niceties of overrides and conflict warnings)



-w


  | david "whit" morriss
  |
  | contact :: http://public.xdi.org/=whit

  "If you don't know where you are,
   you don't know anything at all"

   Dr. Edgar Spencer, Ph.D., 1995


  "I like to write code like
  other ppl like to tune their
  cars or 10kW hifi equipment..."

  Christian Heimes, 2004



-------------------------------------------------------------------------
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