Correct relative path generation in hooke.playlist.FilePlaylist.flatten
authorW. Trevor King <wking@drexel.edu>
Tue, 1 Jun 2010 15:42:53 +0000 (11:42 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 1 Jun 2010 15:42:53 +0000 (11:42 -0400)
hooke/playlist.py

index 336c344d908d84827f89f44a30ad69b3197f7615..963d93558cc28b2f4b590c94739a45343edf8bbf 100644 (file)
@@ -149,7 +149,7 @@ class FilePlaylist (Playlist):
         >>> c.info['note'] = 'The second curve'
         >>> p.append(c)
         >>> p.digest()
-        "\xa1\x99\x8a\x99\xed\xad\x13'\xa7w\x12\x00\x07Z\xb3\xd0zN\xa2\xe1"
+        '\\\x14\x87\x88*q\xf8\xaa\xa7\x84f\x82\xa1S>\xfd3+\xd0o'
         """
         string = self.flatten()
         return hashlib.sha1(string).digest()
@@ -184,8 +184,8 @@ class FilePlaylist (Playlist):
         >>> print p.flatten() # doctest: +NORMALIZE_WHITESPACE +REPORT_UDIFF
         <?xml version="1.0" encoding="utf-8"?>
         <playlist index="0" note="An example playlist" version="0.1">
-            <curve note="The first curve" path="../curve/one"/>
-            <curve note="The second curve" path="../curve/two"/>
+            <curve note="The first curve" path="curve/one"/>
+            <curve note="The second curve" path="curve/two"/>
         </playlist>
         <BLANKLINE>
         >>> print p.flatten(absolute_paths=True) # doctest: +NORMALIZE_WHITESPACE +REPORT_UDIFF
@@ -211,7 +211,9 @@ class FilePlaylist (Playlist):
             if absolute_paths == False:
                 path = os.path.relpath(
                     path,
-                    os.path.abspath(os.path.expanduser(self.path)))
+                    os.path.dirname(
+                        os.path.abspath(
+                            os.path.expanduser(self.path))))
             curve_element.setAttribute('path', path)
             for key,value in curve.info.items():
                 curve_element.setAttribute(key, str(value))