[Checkins] SVN: cipher.configstore/trunk/src/cipher/configstore/configstore. Bugfix: when the Choice field value was invalid, dump used to crash.

Albertas Agejevas cvs-admin at zope.org
Wed Oct 17 15:21:20 UTC 2012


Log message for revision 128025:
  Bugfix: when the Choice field value was invalid, dump used to crash.
  

Changed:
  U   cipher.configstore/trunk/src/cipher/configstore/configstore.py
  U   cipher.configstore/trunk/src/cipher/configstore/configstore.txt

-=-
Modified: cipher.configstore/trunk/src/cipher/configstore/configstore.py
===================================================================
--- cipher.configstore/trunk/src/cipher/configstore/configstore.py	2012-10-17 14:47:52 UTC (rev 128024)
+++ cipher.configstore/trunk/src/cipher/configstore/configstore.py	2012-10-17 15:21:17 UTC (rev 128025)
@@ -213,7 +213,10 @@
         if value is None or value == '':
             return ''
         bound_field = field.bind(self.context)
-        return bound_field.vocabulary.getTerm(value).token
+        try:
+            return bound_field.vocabulary.getTerm(value).token
+        except LookupError:
+            return ''
 
     def dump_type_Tuple(self, value, field):
         return self.listValueSeparator.join(value) if value else ''

Modified: cipher.configstore/trunk/src/cipher/configstore/configstore.txt
===================================================================
--- cipher.configstore/trunk/src/cipher/configstore/configstore.txt	2012-10-17 14:47:52 UTC (rev 128024)
+++ cipher.configstore/trunk/src/cipher/configstore/configstore.txt	2012-10-17 15:21:17 UTC (rev 128025)
@@ -412,6 +412,9 @@
   >>> store.load_type_Choice('', field) is None
   True
 
+  >>> store.dump_type_Choice(3, field)
+  ''
+
 List
 ~~~~
 



More information about the checkins mailing list