[PATCH skos V2] Don't crash if there are no concepts to display

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 31 10:12:50 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490875901 -7200
#      Thu Mar 30 14:11:41 2017 +0200
# Node ID 4203c4d304deacfed96a73e95086fcb387739ce3
# Parent  5982de98291d730dee6497c4fbbb8a4e951ca23a
Don't crash if there are no concepts to display

by first testing it's not an empty rset.

diff --git a/views/__init__.py b/views/__init__.py
--- a/views/__init__.py
+++ b/views/__init__.py
@@ -154,14 +154,16 @@ class ConceptSchemeConceptsTab(tabs.Tabs
             self.w(tags.a(self._cw._('import concepts'),
                           href=entity.absolute_url(vid='skos.scheme.import'),
                           klass='btn btn-success pull-right'))
             self.w(tags.div(klass='clearfix'))
         rset = entity.top_concepts_rset
+        if not rset:
+            return
         if len(rset) < self._cw.property_value('navigation.page-size'):
             treeid = 'skos_tree_%s' % entity.eid
             self._cw.view('treeview', rset=rset, treeid=treeid, initial_thru_ajax=True, w=self.w)
-        elif rset:
+        else:
             self._cw.view('paginated-list', rset=rset, w=self.w)
 
 
 class ConceptPrimaryView(tabs.TabbedPrimaryView):
     __select__ = is_instance('Concept')


More information about the saem-devel mailing list