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

allow for adding custom constistency check from ZMI

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11660 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9f58a967
...@@ -42,6 +42,7 @@ class DocumentCoordinatesConstraint(Constraint): ...@@ -42,6 +42,7 @@ class DocumentCoordinatesConstraint(Constraint):
def checkConsistency(self, o, fixit=0, throw=False): def checkConsistency(self, o, fixit=0, throw=False):
"""Implement here the consistency checker """Implement here the consistency checker
""" """
# XXX we probably could check reference syntax here, based on regexp in preferences?
errors = [] errors = []
for req in ('reference', 'language', 'version'): for req in ('reference', 'language', 'version'):
...@@ -60,6 +61,10 @@ class DocumentCoordinatesConstraint(Constraint): ...@@ -60,6 +61,10 @@ class DocumentCoordinatesConstraint(Constraint):
if len(res)>2: # this is very serious if len(res)>2: # this is very serious
raise Exception('Fatal error: multiple objects %s - %s - %s exist' % (o.getReference(),o.getLanguage(),o.getVersion())) 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 hasattr(o,'Document_additionalConsistencyCheck'):
e=o.Document_additionalConsistencyCheck()
if e is not None and e!='':
errors.append(self._generateError(o, N_(e)))
if errors and throw: if errors and throw:
raise Exception(str(errors)) raise Exception(str(errors))
return errors return errors
......
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