Commits

Steve Losh  committed 32eda85

Catch value errors from bools created before the bugfix.

  • Participants
  • Parent commits 56ede49

Comments (0)

Files changed (2)

File stoat/admin.py

             for pc in page.pagecontent_set.all():
                 # Ugly hack to store booleans as text.
                 if pc.typ == 'bool':
-                    val = True if int(pc.content) else False
+                    try:
+                        val = True if int(pc.content) else False
+                    except ValueError:
+                        val = True
                 else:
                     val = pc.content
 

File stoat/models.py

             except model.DoesNotExist:
                 return None
         elif self.typ == 'bool':
-            return True if int(self.content) else False
+            try:
+                result = True if int(self.content) else False
+            except ValueError:
+                result = True
+            return result
         else:
             return self.content