# HG changeset patch # User Jeff Hammel # Date 1355188250 28800 # Node ID 0affca1f4dc0d7c1a708810a95489bb23ece2e49 # Parent f1f7a505e0d0cf1628b05e26ffbfc6e5e8fe20b2 start using deepcopy since lord knows we cant trust users diff -r f1f7a505e0d0 -r 0affca1f4dc0 wsgraph/model.py --- a/wsgraph/model.py Mon Dec 10 17:08:02 2012 -0800 +++ b/wsgraph/model.py Mon Dec 10 17:10:50 2012 -0800 @@ -1,4 +1,5 @@ from abc import abstractmethod +from copy import deepcopy from utils import iterable class GraphModel(object): @@ -50,9 +51,10 @@ def node(self, name, **values): if values: # setter - self._nodes[name] = values + self._nodes[name] = deepcopy(values) else: # getter + # TODO: deepcopy return self._nodes.get(name, None) def nodes(self): @@ -61,9 +63,10 @@ def edge(self, node1, node2, **values): if values: # setter - self._edges[(node1, node2)] = values + self._edges[(node1, node2)] = deepcopy(values) else: # getter + # TODO: deepcopy return self._edges.get((node1, node2), None) def edges(self):