Commits

Olemis Lang  committed 824d34f

BH Theme #667 : Fix them error when mainnav is empty

... e.g. after revoking all permissions to anonymous user

  • Participants
  • Parent commits 96ccb3c
  • Branches t667_error_mainnav

Comments (0)

Files changed (2)

 t669/t669_r1525378_product_edit.diff
 t669/t669_r1525378_product_edit.tests.diff
 t667/t667_r1526822_error_mainnav.tests.diff
+t667/t667_r1526822_error_mainnav.diff
 t387/t387_r1524640_no_r5994.diff

File t667/t667_r1526822_error_mainnav.diff

+# HG changeset patch
+# Parent 7824faf8acc08d9716ffac8bbd9b6eb5b500eda1
+BH Theme #667 : Fix internal error on empty main nav
+
+diff -r 7824faf8acc0 bloodhound_theme/bhtheme/theme.py
+--- a/bloodhound_theme/bhtheme/theme.py	Tue Oct 01 23:04:21 2013 -0500
++++ b/bloodhound_theme/bhtheme/theme.py	Tue Oct 01 23:19:58 2013 -0500
+@@ -253,9 +253,9 @@
+         req.href.wiki = hwiki
+ 
+         # Move 'admin' entry from mainnav to metanav
+-        for i, entry in enumerate(req.chrome['nav']['mainnav']):
++        for i, entry in enumerate(req.chrome['nav'].get('mainnav', [])):
+             if entry['name'] == 'admin':
+-                req.chrome['nav']['metanav'] \
++                req.chrome['nav'].setdefault('metanav', []) \
+                     .append(req.chrome['nav']['mainnav'].pop(i))
+ 
+         return handler