Remove non-displayable categories from the home page

This commit is contained in:
Charles Haley 2010-10-16 14:54:03 +01:00
parent 468754e7ab
commit 4c207d9b6f

View File

@ -267,6 +267,7 @@ class BrowseServer(object):
def getter(x):
return category_meta[x]['name'].lower()
displayed_custom_fields = custom_fields_to_display(self.db)
for category in sorted(categories,
cmp=lambda x,y: cmp(getter(x), getter(y))):
if len(categories[category]) == 0:
@ -276,6 +277,8 @@ class BrowseServer(object):
meta = category_meta.get(category, None)
if meta is None:
continue
if meta['is_custom'] and category not in displayed_custom_fields:
continue
cats.append((meta['name'], category))
cats = ['<li title="{2} {0}">{0}<span>/browse/category/{1}</span></li>'\
.format(xml(x, True), xml(quote(y)), xml(_('Browse books by')))