changeset 1468:c586981ecf1a

Avoid duplication in state names
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 18 Apr 2011 11:54:10 +0800
parents 6927debad4ee
children c1e70540541c
files pyink/domview.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/domview.py	Mon Apr 18 11:47:52 2011 +0800
+++ b/pyink/domview.py	Mon Apr 18 11:54:10 2011 +0800
@@ -445,6 +445,10 @@
         
         doc = self._comp_mgr._doc
         
+        if name in self.fsm_states:
+            raise KeyError, \
+                'Add a state with a name (%s) been used' % (name)
+        
         state = State()
         state.name = name
         self.fsm_states[name] = state