[z3-checkins] r28616 - z3/Sfive/trunk
philikon at codespeak.net
philikon at codespeak.net
Sat Jun 10 16:27:24 CEST 2006
Author: philikon
Date: Sat Jun 10 16:27:19 2006
New Revision: 28616
Modified:
z3/Sfive/trunk/presentation.py
Log:
Make Zope 2.10 compatible: immutable i18n messages (MessageID -> Message)
Use zope.component.adapts for easier adapter registration in ZCML
Modified: z3/Sfive/trunk/presentation.py
==============================================================================
--- z3/Sfive/trunk/presentation.py (original)
+++ z3/Sfive/trunk/presentation.py Sat Jun 10 16:27:19 2006
@@ -1,13 +1,14 @@
-from zope.i18n import MessageIDFactory
-from zope.interface import implements
-from zope.app.size.interfaces import ISized
-_ = MessageIDFactory('sfive')
+import zope.interface
+import zope.component
+from zope.size.interfaces import ISized
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('sfive')
from OFS.SimpleItem import SimpleItem
from Products.Sfive.interfaces import IPresentation
class Presentation(SimpleItem):
- implements(IPresentation)
+ zope.interface.implements(IPresentation)
meta_type = 'Sfive Presentation'
def __init__(self, id, title):
@@ -34,7 +35,8 @@
u'11 characters'
>>> tearDown()
"""
- implements(ISized)
+ zope.interface.implements(ISized)
+ zope.component.adapts(IPresentation)
def __init__(self, context):
self.context = context
@@ -44,6 +46,4 @@
def sizeForDisplay(self):
unit, chars = self.sizeForSorting()
- msg = _('${chars} characters')
- msg.mapping['chars'] = chars
- return msg
+ return _('${chars} characters', mapping={'chars': chars})
More information about the z3-checkins
mailing list