do not fail in case of missing author

This commit is contained in:
Frédéric Péters 2014-02-28 12:43:19 +01:00
parent 1c0829f7ba
commit fcd7896a87
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class BasePublication(object):
def get_authors_as_string(self):
if not self.authors:
return ''
return ', '.join([x.to_object.title for x in self.authors])
return ', '.join([x.to_object.title for x in self.authors if x.to_object])
@property
def authors_html_str(self):
@ -23,6 +23,7 @@ class BasePublication(object):
return ''
t = []
for x in self.authors:
if x.to_object is None: continue
url = x.to_object.absolute_url()
if 'ministres' in url:
t.append(u'%s' % x.to_object.title)