Remove redundant if check
site_logic.getSingleton() is guaranteed to return an entity.
Patch by: Sverre Rabbelier
--- 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