Dont fail if a non-string object is passed as the title of an article

This commit is contained in:
Kovid Goyal 2018-03-27 12:30:28 +05:30
parent a31c5b90ae
commit 718e3c9237
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -19,7 +19,9 @@ class Article(object):
from lxml import html
self.downloaded = False
self.id = id
title = force_unicode(title or _('Unknown'), 'utf-8')
if not title or not isinstance(title, basestring):
title = _('Unknown')
title = force_unicode(title, 'utf-8')
self._title = clean_xml_chars(title).strip()
try:
self._title = re.sub(r'&(\S+?);',