add consistency check on constraints
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 04 Aug 2009 19:36:22 +0200
changeset 2691 ade319674170
parent 2690 38a4e83c8160
child 2692 bffb0e64736c
add consistency check on constraints
schema.py
--- a/schema.py	Tue Aug 04 18:58:54 2009 +0200
+++ b/schema.py	Tue Aug 04 19:36:22 2009 +0200
@@ -516,6 +516,11 @@
     def __init__(self, restriction):
         self.restriction = restriction
 
+    def check_consistency(self, subjschema, objschema):
+        if objschema.is_final():
+            raise BadSchemaDefinition("unique constraint doesn't apply to "
+                                      "final entity type")
+
     def serialize(self):
         return self.restriction