[Zope3-checkins] CVS: Zope3/src/zope/app/form - widget.py:1.13
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:34:30 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/form
In directory cvs.zope.org:/tmp/cvs-serv4394/src/zope/app/form
Modified Files:
widget.py
Log Message:
Use new translation API.
=== Zope3/src/zope/app/form/widget.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/form/widget.py:1.12 Fri Mar 5 23:17:24 2004
+++ Zope3/src/zope/app/form/widget.py Mon Mar 8 18:33:59 2004
@@ -16,15 +16,13 @@
"""
import traceback
from warnings import warn
+from zope.app import zapi
from zope.app.interfaces.form import IWidget
from zope.component.interfaces import IViewFactory
-from zope.component import queryService
from zope.interface import implements
-from zope.app.services.servicenames import Translation
+from zope.i18n import translate
-__metaclass__ = type
-
-class Widget:
+class Widget(object):
"""Mixin class providing functionality common accross view types."""
implements(IWidget)
@@ -47,13 +45,8 @@
self.context.description))
def _translate(self, text):
- ts = queryService(self.context, Translation)
- if ts is not None:
- # The domain is not that important here, since the title is most
- # likely a message id carrying the domain.
- return (ts.translate(text, "zope", context=self.request) or text)
- else:
- return text
+ return translate(self.context, text, "zope",
+ context=self.request, default=text)
def _renderedValueSet(self):
"""Returns True if the the widget's rendered value has been set.
@@ -72,9 +65,8 @@
def setRenderedValue(self, value):
self._data = value
-class CustomWidgetFactory:
- """Custom Widget Factory.
- """
+class CustomWidgetFactory(object):
+ """Custom Widget Factory."""
implements(IViewFactory)
def __init__(self, *args, **kw):
More information about the Zope3-Checkins
mailing list