document: protect against removed related doc
This commit is contained in:
parent
2a8868e7ba
commit
33e5c76770
|
@ -119,7 +119,7 @@
|
|||
<div id="results">
|
||||
<ul>
|
||||
<tal:entry tal:repeat="object view/related_docs">
|
||||
<li tal:define="oddrow repeat/object/odd" tal:condition="object" tal:attributes="class python: oddrow and 'odd' or 'even'"><div>
|
||||
<li tal:define="oddrow repeat/object/odd" tal:condition="python: object is not None" tal:attributes="class python: oddrow and 'odd' or 'even'"><div>
|
||||
<h4><a href="#" tal:attributes="href object/absolute_url" tal:content="object/reftitle">Véronique Salvi</a></h4>
|
||||
<p class="intitule" tal:content="object/Title"/>
|
||||
<p class="authors" tal:content="python: object.get_authors_as_string()" tal:condition="python: object.authors" />
|
||||
|
|
|
@ -4,7 +4,7 @@ class View(BrowserView):
|
|||
def related_docs(self):
|
||||
if not self.context.related_docs:
|
||||
return []
|
||||
objects = [x.to_object for x in self.context.related_docs]
|
||||
objects = [x.to_object for x in self.context.related_docs if x.to_object]
|
||||
return sorted(objects, lambda x,y: cmp(x.title, y.title))
|
||||
|
||||
class DocumentDownload(BrowserView):
|
||||
|
|
Reference in New Issue