Re: [Plone-cvs] r8236 - in CMFPlone/branches/plip108-five-translationservice: skins/plone_form_scripts skins/plone_prefs skins/plone_scripts tests

classic Classic list List threaded Threaded
2 messages Options
Brent Hendricks Brent Hendricks
Reply | Threaded
Open this post in threaded view
|

Re: [Plone-cvs] r8236 - in CMFPlone/branches/plip108-five-translationservice: skins/plone_form_scripts skins/plone_prefs skins/plone_scripts tests

hannosch wrote:
> Author: hannosch
> Date: Fri Oct 21 10:45:05 2005
> New Revision: 8236
>
> Modified:

[snip]

> Log:
> Changed mapping syntax to comply to Zope X3.0 (which is part of Zope 2.8) and not use the Zope 3.1 style.

Since the Zope 3.1 syntax is cleaner than the 3.0, why not make
PloneMessageFactory a wrapper around the MessageIDFactory that allows
the new syntax?  Something like:

msg_factory = MessageIDFactory('plone')

def PloneMessageFactory(str, default, mapping):
     message = msg_factory(str, default)
     message.mapping.update(mapping)
     return message

Then for future versions we won't have to change as much code, just
eliminate the wrapper.

Brent
--

-------------------------------------------------------------------------

"The programmer, like the poet, works only slightly removed from pure
  thought-stuff.  He builds his castles in the air, from air, creating
  by exertion of the imagination.  Few media of creation are so
  flexible, so easy to polish and rework, so readily capable of
  realizing grand conceptual structures."
                         -- Frederick Brooks, Jr., The Mythical Man Month



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers
Hanno Schlichting Hanno Schlichting
Reply | Threaded
Open this post in threaded view
|

Re: [Plone-cvs] r8236 - in CMFPlone/branches/plip108-five-translationservice: skins/plone_form_scripts skins/plone_prefs skins/plone_scripts tests

Brent Hendricks wrote:

>
> Since the Zope 3.1 syntax is cleaner than the 3.0, why not make
> PloneMessageFactory a wrapper around the MessageIDFactory that allows
> the new syntax?  Something like:
>
> msg_factory = MessageIDFactory('plone')
>
> def PloneMessageFactory(str, default, mapping):
>     message = msg_factory(str, default)
>     message.mapping.update(mapping)
>     return message
>
> Then for future versions we won't have to change as much code, just
> eliminate the wrapper.
>
> Brent

Excellent idea.

I have just implemented it and it seems to work like a charm :) Added a
BBB comment for the time when we won't have to support Zope 2.8 anymore,
which will be quite a while I suppose ;)

Hanno

My version looks like this, though:

def PloneMessageFactory(ustr, default=None, mapping=None):
     message = msg_factory(ustr, default)
     if mapping is not None:
         message.mapping.update(mapping)
     return message



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers