From 8956684d7f991613fd22de562b129ffe11e35351 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 7 Aug 2010 14:22:38 -0400 Subject: [PATCH] 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/ --- hooke/playlist.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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() -- 2.26.2