error resilient state method
authorsylvain.thenault@logilab.fr
Mon, 19 Jan 2009 17:28:42 +0100
changeset 441 49e4717e2371
parent 440 3b3c2b6699fd
child 442 b1cf7611f8b3
error resilient state method
common/mixins.py
--- a/common/mixins.py	Mon Jan 19 08:57:34 2009 +0100
+++ b/common/mixins.py	Mon Jan 19 17:28:42 2009 +0100
@@ -165,7 +165,11 @@
     
     @property
     def state(self):
-        return self.in_state[0].name
+        try:
+            return self.in_state[0].name
+        except IndexError:
+            self.warning('entity %s has no state', self)
+            return None
     
     @property
     def displayable_state(self):