Commit 2ec9e211 authored by Florent Cayré's avatar Florent Cayré
Browse files

[base views] make it easier to override EntityStartupView behaviour when the...

[base views] make it easier to override EntityStartupView behaviour when the rset is empty; closes #2126364

--HG--
branch : stable
parent 5bc91cc51fe3
......@@ -417,6 +417,10 @@ class EntityStartupView(EntityView):
"""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 @@ class EntityStartupView(EntityView):
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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment