[manage view] get etypes first to avoid xhtml validation error if no one found
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 10 Feb 2011 16:21:23 +0100
changeset 6973 d2cd38749c17
parent 6972 12aa5cd81ce5
child 6974 6f23b2baf99b
[manage view] get etypes first to avoid xhtml validation error if no one found
web/views/startup.py
--- a/web/views/startup.py	Thu Feb 10 16:20:49 2011 +0100
+++ b/web/views/startup.py	Thu Feb 10 16:21:23 2011 +0100
@@ -77,13 +77,14 @@
 
     def entities(self):
         schema = self._cw.vreg.schema
-        self.w(u'<div class="hr">&#160;</div>')
-        self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by entity type'))
-        manager = self._cw.user.matching_groups('managers')
-        self.w(u'<table class="startup">')
-        self.entity_types_table(eschema for eschema in schema.entities()
-                                if uicfg.indexview_etype_section.get(eschema) == 'application')
-        self.w(u'</table>')
+        eschemas = [eschema for eschema in schema.entities()
+                    if uicfg.indexview_etype_section.get(eschema) == 'application']
+        if eschemas:
+            self.w(u'<div class="hr">&#160;</div>')
+            self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by entity type'))
+            self.w(u'<table class="startup">')
+            self.entity_types_table(eschemas)
+            self.w(u'</table>')
 
     def entity_types_table(self, eschemas):
         infos = sorted(self.entity_types(eschemas),