From 16ac982efe0c01426c39f09875d1b1b4fca09839 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 23 Feb 2013 15:39:51 +0100 Subject: [PATCH] Bugfix for the removal of empty sub-directories. --- sigal/gallery.py | 3 ++- tests/test_gallery.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sigal/gallery.py b/sigal/gallery.py index 7024a33..ca0e8c6 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -105,7 +105,8 @@ class PathsDb(object): self.db['paths_list'].remove(path) del self.db[path] parent = os.path.normpath(join(path, '..')) - self.db[parent]['subdir'].remove(path) + child = os.path.relpath(path, parent) + self.db[parent]['subdir'].remove(child) def check_thumbnail(self, path): "Find the thumbnail image for a given path." diff --git a/tests/test_gallery.py b/tests/test_gallery.py index 4a1186a..970f0d2 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -60,7 +60,7 @@ class TestPathsDb(unittest.TestCase): self.assertListEqual(self.db['paths_list'], ['.', 'dir1', 'dir1/test1', 'dir1/test2', 'dir2']) - self.assertListEqual(self.db['skipped_dir'], ['empty']) + self.assertItemsEqual(self.db['skipped_dir'], ['empty', 'dir1/empty']) self.assertListEqual(self.db['.']['img'], []) self.assertItemsEqual(self.db['.']['subdir'], ['dir1', 'dir2'])