pngtile.store: change list() to yield name, type tuples rather than appending / to dirs
--- a/pngtile/image.py Sat Oct 04 03:28:57 2014 +0300
+++ b/pngtile/image.py Sat Oct 04 15:13:56 2014 +0300
@@ -76,6 +76,13 @@
yield html.li(html.a(href=href(*path), *[part]))
+ def render_dir_item (self, name, type):
+ if type:
+ return html.a(href=name, *[name])
+ else:
+ dir = name + '/'
+ return html.a(href=dir, *[dir])
+
def render_dir (self, request, name, items):
"""
request: werkzeug.Request
@@ -97,10 +104,11 @@
html.ol(class_='breadcrumb', *self.render_dir_breadcrumb(name)),
]),
html.div(class_='list', *[
- html.ul(class_='list-group', *[html.li(class_='list-group-item', *[
- html.a(href=item, *[item])
- ]) for item in items]
- ),
+ html.ul(class_='list-group', *[
+ html.li(class_='list-group-item', *[
+ self.render_dir_item(name, type) for name, type in items
+ ]) for name, type in items
+ ]),
]),
]),
),
--- a/pngtile/store.py Sat Oct 04 03:28:57 2014 +0300
+++ b/pngtile/store.py Sat Oct 04 15:13:56 2014 +0300
@@ -102,7 +102,7 @@
# skip inaccessible dirs
continue
- yield name + '/'
+ yield name, None
# examine ext
if '.' in name:
@@ -113,7 +113,7 @@
# show .png files with a .cache file
if name_type in self.IMAGE_TYPES and os.path.exists(os.path.join(root, name_base + '.cache')):
- yield name
+ yield name, name_type
def open (self, url):
"""