Fix error when collection is not found

This commit is contained in:
Laurent Lasudry 2018-11-07 11:02:13 +01:00
parent 17972a91c4
commit 605f354a6d
2 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,8 @@
<span class="portletTopRight"></span>
</dt>
<dd class="portletItem" tal:define="table python: view.table()">
<dd class="portletItem" tal:define="table python: view.table()"
tal:condition="table">
<div tal:attributes="class python: table.__class__.__name__"
tal:content="structure python: table.render()">
</div>

View File

@ -152,7 +152,10 @@ class Renderer(base.Renderer):
return result
def table(self):
table_class = get_appropriate_table_class(self.context, self.collection().query)
collection = self.collection()
if collection is None:
return
table_class = get_appropriate_table_class(self.context, collection.query)
table = table_class(self, self.request)
table.values = self.results()
table.update()