Changed DictValidator so that long and int datatypes are not treated as different...
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 21 Apr 2013 20:07:11 +0000 (20:07 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 21 Apr 2013 20:07:11 +0000 (20:07 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1375 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrvalidators.py
wrpylib/wrvalidators.py

index 19fca40e7259363f3774e6ac88e3c5ae1421023c..c28c5764b2f6b9a54eacc8887d2c4c7adad1da86 100644 (file)
@@ -142,6 +142,7 @@ def test_GermanPublicTransport():
     assert v.from_python(4) == u'Schlecht'
     assert v.from_python(5) == u'Nein'
     assert v.from_python(6) == u'Ja'
+    assert v.from_python(1l) == u'Sehr gut'
 
 
 # test_GermanTristateFloatComment
index 7d8b67023ace36d8418d9217c4119c464613413d..416e5d0d2cfd76f68ce0e58661ba238562b3f2be 100644 (file)
@@ -149,7 +149,8 @@ class DictValidator(formencode.FancyValidator):
     
     def from_python(self, value):
         for k, v in self.dict.iteritems():
-            if type(v) == type(value) and v == value: return k
+            if v == value:
+                return k
         raise formencode.Invalid('Invalid value', value, None)