Set ._digest after saving in hooke.playlist.FilePlaylist.save()
authorW. Trevor King <wking@drexel.edu>
Sat, 7 Aug 2010 18:22:38 +0000 (14:22 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 7 Aug 2010 18:22:38 +0000 (14:22 -0400)
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

index dcd85b8797cabb0cc2696a548d700cb092a13445..8d889a3da3cd91c9eebb54eba745cc7dc198ea16 100644 (file)
@@ -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()