From de1ccc88e616f7653252d245aba4ba05df8a5ebc Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 9 May 2011 22:39:09 +0200 Subject: [PATCH] bugfix for representative image --- sigal/theme.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sigal/theme.py b/sigal/theme.py index ec6b379..fc0d306 100644 --- a/sigal/theme.py +++ b/sigal/theme.py @@ -160,16 +160,20 @@ class Theme(): albums = [] for d in self.data[dirpath]['subdir']: + + dpath = os.path.join(dirpath, d) + alb_thumb = '' - if self.data[dirpath].has_key('representative'): - alb_thumb = self.data[dirpath]['representative'] + if self.data[dpath].has_key('representative'): + alb_thumb = self.data[dpath]['representative'] - if not alb_thumb or not os.path.isfile(alb_thumb): - alb_thumb = self.find_representative(os.path.join(dirpath, d)) + if not alb_thumb or \ + not os.path.isfile(os.path.join(dpath, alb_thumb)): + alb_thumb = self.find_representative(dpath) album = { 'path': os.path.join(d, INDEX_PAGE), - 'title': self.data[os.path.join(dirpath, d)]['title'], + 'title': self.data[dpath]['title'], 'thumb': os.path.join(d, self.thumb_dir, self.thumb_prefix+alb_thumb), }