Re: AT widget simplifications (was) looking at AT schema: (was) zope 3 schema's and the rest of us
Hanno Schlichting <plone-+xqiSR9SqHsk+I/[email protected]> Fri, 14 Jul 2006 09:01:57 +0200
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi.
At this point I should probably mention that I already did some work on
Archetypes 1.5 and internationalization and while it is not much it
simplifies the widget example a bit and what's more important it makes
it a lot more compatible with the way Zope 3 handles these. Instead of
whit's example in AT trunk this would look right now like:
whit wrote:
> 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")
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('plone')
widget = atapi.RichWidget(
description = _(u'help_body_text',
default=u'The body text of the document.'),
label = _(u'label_body_text',
default=u'Body text'),
rows = 25)
> which does the same as:
>
> <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" />
<configure xmlns="http://namespaces.zope.org/zope"
i18n_domain="plone">
<at:widget
name='default'
provides='archetypes.widget.IRichWidget'
description = "[help_body_text] The body text of the document.",
label = "[label_body_text] Body text",
rows = 25 />
</configure>
Now the parser for the above code would create the Message objects in
the right domain automatically, as it does it in Zope 3 in a lot of
places ;)
Of course the old AT approach using special _msgid and i18n_domain
attributes still works but if you look into Archetypes/generator (which
is the base for all AT widgets) you will notice that the code is already
simpler. Again this should help at least for the widgets to be more
compatible with their Zope 3 counterparts :)
Hanno
-------------------------------------------------------------------------
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