Bug fix in Shelf.getImageVersionByLocation: Make sure argument
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 8 Mar 2005 21:51:18 +0000 (21:51 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 8 Mar 2005 21:51:18 +0000 (21:51 +0000)
is normalized properly.

src/lib/kofoto/shelf.py
src/test/shelftests.py

index dc254a5..e88972c 100644 (file)
@@ -996,6 +996,7 @@ class Shelf:
         """
         assert self.inTransaction
 
+        location = os.path.abspath(location)
         cursor = self.connection.cursor()
         cursor.execute(
             " select id"
index af79d6e..0fd04b7 100755 (executable)
@@ -443,8 +443,16 @@ class TestShelfMethods(TestShelfFixture):
             assert False
 
     def test_getImageVersionByLocation(self):
-        imageversion = self.shelf.getImageVersionByLocation(
-            os.path.join(PICDIR, "arlaharen.png"))
+        imageversion1 = self.shelf.getImageVersionByLocation(
+            os.path.join(PICDIR, u"arlaharen.png"))
+        currentDir = os.getcwd()
+        try:
+            os.chdir(PICDIR)
+            imageversion2 = self.shelf.getImageVersionByLocation(
+                u"arlaharen.png")
+        finally:
+            os.chdir(currentDir)
+        assert imageversion1 == imageversion2
 
     def test_negativeGetImageVersionByHash(self):
         try: