From: W. Trevor King Date: Sat, 7 Aug 2010 18:22:38 +0000 (-0400) Subject: Set ._digest after saving in hooke.playlist.FilePlaylist.save() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e5ba48b30d2af3ab67601506419ea265abb2651d;p=hooke.git Set ._digest after saving in hooke.playlist.FilePlaylist.save() The old implementation would complain of unsaved playlists upon exiting if it was different from the originally loaded version, even if you'd just saved the playlist! We also switch to the more robust `with` syntax: http://www.python.org/dev/peps/pep-0343/ --- diff --git a/hooke/playlist.py b/hooke/playlist.py index dcd85b8..8d889a3 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -348,6 +348,6 @@ class FilePlaylist (Playlist): """Saves the playlist in a XML file. """ self.set_path(path) - f = file(self.path, 'w') - f.write(self.flatten()) - f.close() + with open(self.path, 'w') as f: + f.write(self.flatten()) + self._digest = self.digest()