From: Michael Tremer Date: Thu, 22 Apr 2010 13:29:05 +0000 (+0200) Subject: Add option to show no banner at all. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a01d219e0a05e47280142b86101073f3ef9be6a;p=ipfire.org.git Add option to show no banner at all. --- diff --git a/www/templates/modules/sidebar-banner.html b/www/templates/modules/sidebar-banner.html index 7a10b3b7..fb891fca 100644 --- a/www/templates/modules/sidebar-banner.html +++ b/www/templates/modules/sidebar-banner.html @@ -1,5 +1,7 @@ -

{{ item.title }}

+{% if item %} +

{{ item.title }}

- - {{ _( - + + {{ _( + +{% end %} diff --git a/www/webapp/banners.py b/www/webapp/banners.py index ba21ab99..65aeac8d 100644 --- a/www/webapp/banners.py +++ b/www/webapp/banners.py @@ -20,7 +20,8 @@ class Banners(object): self.items.append(Item(**_stringify(item))) def get(self): - return random.choice(self.items) + if self.items: + return random.choice(self.items) banners = Banners("banners.json")