[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - vocabularywidget.py:1.43

Fred L. Drake, Jr. fred@zope.com
Tue, 17 Jun 2003 12:02:14 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv21038

Modified Files:
	vocabularywidget.py 
Log Message:
Move _msg_no_value onto a class instance, so subclasses or instances
can override.


=== Zope3/src/zope/app/browser/form/vocabularywidget.py 1.42 => 1.43 ===
--- Zope3/src/zope/app/browser/form/vocabularywidget.py:1.42	Tue Jun 17 10:24:49 2003
+++ Zope3/src/zope/app/browser/form/vocabularywidget.py	Tue Jun 17 12:02:13 2003
@@ -124,9 +124,6 @@
     return msgid
 
 
-_msg_no_value = message(_("vocabulary-no-value"), "(no value)")
-
-
 # Widget implementation:
 
 class ViewSupport(object, TranslationHook):
@@ -261,6 +258,8 @@
 
 class SingleDataHelper(object):
 
+    _msg_no_value = message(_("vocabulary-no-value"), "(no value)")
+
     def _compute_data(self):
         if self.name in self.request.form:
             token = self.request.form[self.name]
@@ -290,7 +289,7 @@
 
     def render(self, value):
         if value is None:
-            return self.translate(_msg_no_value)
+            return self.translate(self._msg_no_value)
         else:
             term = self.context.vocabulary.getTerm(value)
             return self.textForValue(term)
@@ -516,7 +515,7 @@
         L = self.renderItemsWithValues(values)
         if not self.context.required:
             option = ("<option name='%s' value=''>%s</option>"
-                      % (self.name, self.translate(_msg_no_value)))
+                      % (self.name, self.translate(self._msg_no_value)))
             L.insert(0, option)
         return L