Commit fbfafbdd authored by Bartek Górny's avatar Bartek Górny

handle exception when we look for the latest version in a language in which there are no documents

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15374 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dbdae69f
...@@ -655,9 +655,12 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -655,9 +655,12 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
original_language = self.getOriginalLanguage() original_language = self.getOriginalLanguage()
user_language = self.Localizer.get_selected_language() user_language = self.Localizer.get_selected_language()
# if language was given return it # if language was given return it (if there are any docs in this language)
if language is not None: if language is not None:
return res[0].getObject() try:
return res[0].getObject()
except IndexError:
return None
else: else:
first = res[0] first = res[0]
in_original = None in_original = None
......
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