view.py
branchstable
changeset 8174 b3e87e6865ef
parent 8013 7b2b8a7fb96d
child 8190 2a3c1b787688
child 8204 332596be995e
--- a/view.py	Wed Jan 18 16:14:34 2012 +0100
+++ b/view.py	Wed Jan 18 17:27:11 2012 +0100
@@ -417,6 +417,10 @@
         """return some rql to be executed if the result set is None"""
         return self.default_rql
 
+    def no_entities(self, **kwargs):
+        """override to display something when no entities were found"""
+        pass
+
     def call(self, **kwargs):
         """override call to execute rql returned by the .startup_rql method if
         necessary
@@ -424,8 +428,11 @@
         rset = self.cw_rset
         if rset is None:
             rset = self.cw_rset = self._cw.execute(self.startup_rql())
-        for i in xrange(len(rset)):
-            self.wview(self.__regid__, rset, row=i, **kwargs)
+        if rset:
+            for i in xrange(len(rset)):
+                self.wview(self.__regid__, rset, row=i, **kwargs)
+        else:
+            self.no_entities(**kwargs)
 
 
 class AnyRsetView(View):