summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-17 17:05:28 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 08:41:54 +0200
commit171ca7741ca5025380035b5c8beda17b6aa010f0 (patch)
tree9c847f264b16ef021f71602c03e4b8eb5aeb9417
parent7920c7633b3c1e089e77714f64c9c8c827f9b37a (diff)
downloadIshtar-171ca7741ca5025380035b5c8beda17b6aa010f0.tar.bz2
Ishtar-171ca7741ca5025380035b5c8beda17b6aa010f0.zip
Fix menu initialization
-rw-r--r--ishtar_common/models.py6
-rw-r--r--ishtar_common/views.py8
-rw-r--r--ishtar_common/wizards.py3
3 files changed, 8 insertions, 9 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 8d6278151..5d48dd813 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1696,8 +1696,10 @@ def get_current_profile(force=False):
def cached_site_changed(sender, **kwargs):
get_current_profile(force=True)
- from ishtar_common.menus import menu
- menu.reinit_menu_for_all_user()
+ from ishtar_common.menus import Menu
+ MAIN_MENU = Menu(None)
+ MAIN_MENU.init()
+ MAIN_MENU.reinit_menu_for_all_user()
post_save.connect(cached_site_changed, sender=IshtarSiteProfile)
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 5266f6cd7..e5fdff2fe 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -465,13 +465,9 @@ def update_current_item(request, item_type=None, pk=None):
return HttpResponse('ok')
-MAIN_MENU = None
-
-
def check_permission(request, action_slug, obj_id=None):
- if not MAIN_MENU:
- MAIN_MENU = Menu(None)
- MAIN_MENU.init()
+ MAIN_MENU = Menu(None)
+ MAIN_MENU.init()
if action_slug not in MAIN_MENU.items:
# TODO
return True
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index cc0371982..dcad096cf 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -391,7 +391,8 @@ class Wizard(NamedUrlWizardView):
if key == "DELETE" and value:
is_deleted = True
# no display when no label or no value
- if not lbl.strip() or value is None or value == '':
+ if not lbl or not lbl.strip() or value is None \
+ or value == '':
continue
if key in self.translated_keys:
value = _(value)