Commit 8e890207 authored by Yoshinori Okuji's avatar Yoshinori Okuji

If raising an exception, do it explicitly to include useful information.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2bb2138f
......@@ -72,6 +72,9 @@ def _getEffectiveModel(self, start_date=None, stop_date=None):
model_list = self.getPortalObject().portal_catalog.unrestrictedSearchResults(
query=ComplexQuery(logical_operator='AND', *query_list),
sort_on=(('version', 'descending'),))
if not model_list:
raise KeyError('No %s found with the reference %s between %s and %s' % \
(self.getPortalType(), reference, start_date, stop_date))
return model_list[0].getObject()
......
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