[Erp5-report] r10360 - /erp5/trunk/products/ERP5OOo/Constraint/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Sep 27 16:16:20 CEST 2006
Author: bartek
Date: Wed Sep 27 16:16:19 2006
New Revision: 10360
URL: http://svn.erp5.org?rev=10360&view=rev
Log:
optionally raise exceptions instead of returning error message
Modified:
erp5/trunk/products/ERP5OOo/Constraint/DocumentCoordinatesConstraint.py
Modified: erp5/trunk/products/ERP5OOo/Constraint/DocumentCoordinatesConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Constraint/DocumentCoordinatesConstraint.py?rev=10360&r1=10359&r2=10360&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Constraint/DocumentCoordinatesConstraint.py (original)
+++ erp5/trunk/products/ERP5OOo/Constraint/DocumentCoordinatesConstraint.py Wed Sep 27 16:16:19 2006
@@ -39,7 +39,7 @@
we do not fix (although we could, e.g. change version number)
"""
- def checkConsistency(self, o, fixit=0):
+ def checkConsistency(self, o, fixit=0, throw=False):
"""Implement here the consistency checker
"""
errors = []
@@ -49,6 +49,8 @@
s='%s is None ' % req
errors.append(self._generateError(o, N_(s)))
if errors:
+ if throw:
+ raise Exception(str(errors))
return errors
res=o.portal_catalog(reference=o.getReference(),language=o.getLanguage(),version=o.getVersion(),portal_type=o.getPortalDocumentTypeList())
res=list(res)
@@ -57,7 +59,9 @@
errors.append(self._generateError(o, N_(s)))
if len(res)>2: # this is very serious
raise Exception('Fatal error: multiple objects %s - %s - %s exist' % (o.getReference(),o.getLanguage(),o.getVersion()))
- errors.append(self._generateError(o, N_(s)))
+ #errors.append(self._generateError(o, N_(s)))
+ if errors and throw:
+ raise Exception(str(errors))
return errors
More information about the Erp5-report
mailing list