Remove redundant if check
authorSverre Rabbelier <srabbelier@gmail.com>
Wed, 15 Apr 2009 23:21:40 +0000
changeset 2189 8c9ab031a6b3
parent 2188 95b23c66257b
child 2190 399fc9411abc
Remove redundant if check site_logic.getSingleton() is guaranteed to return an entity. Patch by: Sverre Rabbelier
app/soc/views/models/site.py
--- a/app/soc/views/models/site.py	Wed Apr 15 19:13:52 2009 +0000
+++ b/app/soc/views/models/site.py	Wed Apr 15 23:21:40 2009 +0000
@@ -134,25 +134,22 @@
 
     entity = self._logic.getSingleton()
 
-    submenus = []
-
-    if entity:
-      submenus += document_view.view.getMenusForScope(entity, self._params)
+    submenus = document_view.view.getMenusForScope(entity, self._params)
 
-      try:
-        rights = self._params['rights']
-        rights.setCurrentUser(id, user)
-        rights.checkIsHost()
-        is_host = True
-      except out_of_band.Error:
-        is_host = False
+    try:
+      rights = self._params['rights']
+      rights.setCurrentUser(id, user)
+      rights.checkIsHost()
+      is_host = True
+    except out_of_band.Error:
+      is_host = False
 
-      if is_host:
-        submenus += [(redirects.getCreateDocumentRedirect(entity, 'site'),
-            "Create a New Document", 'any_access')]
+    if is_host:
+      submenus += [(redirects.getCreateDocumentRedirect(entity, 'site'),
+          "Create a New Document", 'any_access')]
 
-        submenus += [(redirects.getListDocumentsRedirect(entity, 'site'),
-            "List Documents", 'any_access')]
+      submenus += [(redirects.getListDocumentsRedirect(entity, 'site'),
+          "List Documents", 'any_access')]
 
     new_params = {}
     new_params['sidebar_additional'] = submenus