- def set_unmodified(self):
- """Recursively clear modified flag."""
- self._modified = False
- for k,v in self._items.items():
- v.set_unmodified()
+ def committed(self):
+ """Determine if the collection has been committed to the API server."""
+ return self._committed
+
+ @synchronized
+ def set_committed(self, value=True):
+ """Recursively set committed flag.
+
+ If value is True, set committed to be True for this and all children.
+
+ If value is False, set committed to be False for this and all parents.
+ """
+ if value == self._committed:
+ return
+ if value:
+ for k,v in self._items.items():
+ v.set_committed(True)
+ self._committed = True
+ else:
+ self._committed = False
+ if self.parent is not None:
+ self.parent.set_committed(False)