[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/registration - __init__.py:1.5

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 7 21:15:10 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/services/registration
In directory cvs.zope.org:/tmp/cvs-serv25289/browser/services/registration

Modified Files:
	__init__.py 
Log Message:
I18ned some more. Wow, the RegistrationWidget was tricky, but I fixed it.
I made the RegistrationWidget inherit from RadioWidget, which should have
been done this way in the first place.

I also noticed that there are still occurences where the interface field
attributes are not message-id'ed.


=== Zope3/src/zope/app/browser/services/registration/__init__.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/registration/__init__.py:1.4	Thu Aug  7 16:27:33 2003
+++ Zope3/src/zope/app/browser/services/registration/__init__.py	Thu Aug  7 20:14:36 2003
@@ -17,7 +17,7 @@
 """
 
 from zope.app.browser.container.adding import Adding
-from zope.app.browser.form.widget import BrowserWidget
+from zope.app.browser.form.widget import RadioWidget, BrowserWidget
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.interfaces.browser.form import IBrowserWidget
 from zope.app.interfaces.container import IZopeContainer
@@ -183,21 +183,14 @@
         self.message = message
 
 
-class RegistrationStatusWidget(BrowserWidget):
+class RegistrationStatusWidget(RadioWidget):
 
+    def _getDefault(self):
+        return UnregisteredStatus
+        
     def __call__(self):
-        checked = self._showData() or UnregisteredStatus
-        result = [
-            ('<label>'
-             '<input type="radio" name="%s" value="%s"%s>'
-             '&nbsp;'
-             '%s'
-             '</label>'
-             % (self.name, v, (v == checked and ' checked' or ''), v)
-             )
-            for v in (UnregisteredStatus, RegisteredStatus, ActiveStatus)
-            ]
-        return ' '.join(result)
+        rendered_items = self.renderItems(self._showData())
+        return "&nbsp;&nbsp;".join(rendered_items)
 
 
 class ComponentPathWidget(BrowserWidget):




More information about the Zope3-Checkins mailing list