diff wsgraph/model.py @ 31:5f14a4183bf2

fix things
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 13 Dec 2012 18:52:04 -0800
parents 4bed1424bb3f
children 943a4b7097af
line wrap: on
line diff
--- a/wsgraph/model.py	Thu Dec 13 18:11:52 2012 -0800
+++ b/wsgraph/model.py	Thu Dec 13 18:52:04 2012 -0800
@@ -66,6 +66,13 @@
         else:
             return self.edge(*key)
 
+    def __setitem__(self, key, value):
+        if isinstance(key, basestring) or (not isiterable(key)):
+            self.node(key, value)
+        else:
+            key1, key2 = key
+            self.edge(key1, key2, value)
+
     def __contains__(self, key):
         """
         if key is ..., returns if that node is in the graph