lib/folder.py
changeset 26 81d6679d50d0
parent 23 10841abbc01f
child 27 301d738b1181
--- a/lib/folder.py	Sun Jan 20 01:52:00 2008 +0000
+++ b/lib/folder.py	Thu Jan 31 17:28:02 2008 +0000
@@ -160,24 +160,24 @@
                 # add to the sorted images list
                 self.sorted_images.append(img)
                 
-            # figure out our title/ descr. Must be done before our parent dir is rendered (self.title)
-            title_path = self.pathFor(settings.TITLE_FILE)
-            
-            self.title, self.descr = utils.readTitleDescr(title_path)
+        # figure out our title/ descr. Must be done before our parent dir is rendered (self.title)
+        title_path = self.pathFor(settings.TITLE_FILE)
+        
+        self.title, self.descr = utils.readTitleDescr(title_path)
+        
+        # default title for the root dir
+        if self.title :
+            self.alive = True
+            pass # use what was in the title file
             
-            # default title for the root dir
-            if self.title :
-                self.alive = True
-                pass # use what was in the title file
-                
-            elif not self.parent :
-                self.title = 'Index'
+        elif not self.parent :
+            self.title = 'Index'
 
-            else :
-                self.title = self.name
-            
-            if self.descr :
-                self.alive = True
+        else :
+            self.title = self.name
+        
+        if self.descr :
+            self.alive = True
 
         return self.alive
 
@@ -274,13 +274,16 @@
 
             if pagination_required :
                 render.info("Index split into %d pages of %d images each", len(pages), settings.IMAGE_COUNT)
-            
+            elif not pages :
+                render.info("Dir with no images, render for subdirs")
+                pages = [[]]
+
             for cur_page, images in enumerate(pages) :
                 if pagination_required and cur_page > 0 :
                     shorturl = "%s/%s" % (self.shorturl_code, cur_page+1)
                 else :
                     shorturl = self.shorturl_code
-
+                
                 # render to index.html
                 gallery_tpl.render_to(self.pathFor(url_for_page(cur_page)), 
                     stylesheet_url               = self.inRoot('style.css'),