[Zope3-checkins] SVN: Zope3/branches/3.2/ Backport from trunk.

Bjorn Tillenius bjorn.tillenius at gmail.com
Wed Apr 12 06:28:31 EDT 2006


Log message for revision 66880:
  Backport from trunk.
  
  ------------------------------------------------------------------------
  r66879 | BjornT | 2006-04-12 13:16:53 +0300 (Wed, 12 Apr 2006) | 7 lines
  
  Fix issue 448, SingleDataHelper.hidden() raised a LookupError if there was no
  input.
  
  This is only a workaround for http://www.zope.org/Collectors/Zope3-dev/584,
  though, which is much harder to fix.
  
  
  ------------------------------------------------------------------------
  
  

Changed:
  U   Zope3/branches/3.2/doc/CHANGES.txt
  U   Zope3/branches/3.2/src/zope/app/form/browser/itemswidgets.py

-=-
Modified: Zope3/branches/3.2/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.2/doc/CHANGES.txt	2006-04-12 10:16:53 UTC (rev 66879)
+++ Zope3/branches/3.2/doc/CHANGES.txt	2006-04-12 10:28:30 UTC (rev 66880)
@@ -15,6 +15,9 @@
 
       - Fixed a bug in field prefix handling in formlib's setUp*Widgets.
 
+      - Fixed issue 448, SingleDataHelper.hidden() raised a LookupError
+        if there was no input value.
+
   Zope 3.2.1 (2006/03/26)
 
     Bug fixes

Modified: Zope3/branches/3.2/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/form/browser/itemswidgets.py	2006-04-12 10:16:53 UTC (rev 66879)
+++ Zope3/branches/3.2/src/zope/app/form/browser/itemswidgets.py	2006-04-12 10:28:30 UTC (rev 66880)
@@ -161,12 +161,21 @@
             return self.context.missing_value
 
     def hidden(self):
+        #XXX: _getFormValue() should return a string value that can be
+        #     used in a HTML form, but it doesn't. When
+        #     http://www.zope.org/Collectors/Zope3-dev/584 gets fixed
+        #     this hack should be reverted.
+        #     -- Bjorn Tillenius, 2006-04-12
+        value = self._getFormValue()
+        if value == self._missing:
+            form_value = ''
+        else:
+            form_value = self.vocabulary.getTerm(value).token
         return renderElement(u'input',
                              type='hidden',
                              name=self.name,
                              id=self.name,
-                             value=self.vocabulary.getTerm(
-                                self._getFormValue()).token,
+                             value=form_value,
                              cssClass=self.cssClass,
                              extra=self.extra)
 



More information about the Zope3-Checkins mailing list