topmenu if user is not authenticated, when activate email for example
authorLoic Baron <loic.baron@lip6.fr>
Sat, 25 Apr 2015 09:40:41 +0000 (11:40 +0200)
committerLoic Baron <loic.baron@lip6.fr>
Sat, 25 Apr 2015 09:40:41 +0000 (11:40 +0200)
ui/topmenu.py

index 0b022b5..0c8d225 100644 (file)
@@ -76,8 +76,11 @@ def topmenu_items_live (current, page):
     # We might use local storage instead
 
     # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2
-    query_pi_auths = Query.get('myslice:user').filter_by('user_hrn', '==', '$user_hrn' ).select('user_hrn','pi_authorities')
-    page.enqueue_query(query_pi_auths)
+    if request.user.is_authenticated ():
+        query_pi_auths = Query.get('myslice:user').filter_by('user_hrn', '==', '$user_hrn' ).select('user_hrn','pi_authorities')
+        page.enqueue_query(query_pi_auths)
+    else:
+        query_pi_auths = Query()
 #        # even though this plugin does not have any html materialization, the corresponding domid
 #        # must exist because it is searched at init-time to create the JS plugin
 #        # so we simply piggy-back the target button created in the topmenu