From d953c0f2dbe74ccb1be5feba0fdfab7c82bbdcda Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Thu, 7 Mar 2013 16:55:43 +0100 Subject: [PATCH] Replace _constraints with validate in ModelStorage and improve user messages. issue2616 review371002 --- work.py | 12 +++++------- work.xml | 9 +++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/work.py b/work.py index cdeb3f2969..2c84f2a85a 100644 --- a/work.py +++ b/work.py @@ -73,13 +73,11 @@ class Work: @classmethod def __setup__(cls): super(Work, cls).__setup__() - cls._constraints += [ - ('check_recursion', 'recursive_dependency'), - ] - cls._error_messages.update({ - 'recursive_dependency': 'You can not create recursive ' - 'dependencies!', - }) + + @classmethod + def validate(cls, works): + super(Work, cls).validate(works) + cls.check_recursion(works) @classmethod def check_recursion(cls, records, parent='successors'): diff --git a/work.xml b/work.xml index 42f56ced99..c34ee5b074 100644 --- a/work.xml +++ b/work.xml @@ -64,5 +64,14 @@ this repository contains the full copyright notices and license terms. --> project.work + + project.work + en_US + error + recursion_error + Recursion error: Project Work "%(rec_name)s" with parent "%(parent_rec_name)s" was configured as ancestor of itself. + project_plan + +