[migration] fix handling of default value for boolean attributes
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 12 Dec 2013 14:25:24 +0100
changeset 9360 eda5071e30a1
parent 9359 31a1813d53f3
child 9361 0542a85fe667
[migration] fix handling of default value for boolean attributes We can't assert that the old value is 'True' or 'False', because False used to be stored as an empty string in pre-3.18 versions.
misc/migration/3.18.0_Any.py
--- a/misc/migration/3.18.0_Any.py	Thu Dec 12 12:34:38 2013 +0100
+++ b/misc/migration/3.18.0_Any.py	Thu Dec 12 14:25:24 2013 +0100
@@ -8,7 +8,8 @@
         return
     atype = cwattr.to_entity[0].name
     if atype == 'Boolean':
-        assert default in ('True', 'False'), default
+        # boolean attributes with default=False were stored as ''
+        assert default in ('True', 'False', ''), repr(default)
         default = default == 'True'
     elif atype in ('Int', 'BigInt'):
         default = int(default)