[schema] neuter check method for constraints we implement in sql
authorJulien Cristau <julien.cristau@logilab.fr>
Sun, 22 Mar 2015 19:10:13 +0100
changeset 10447 d309c020d9fb
parent 10446 1e6655cff5ab
child 10448 de5be53e2ea8
[schema] neuter check method for constraints we implement in sql Closes #5154406.
schema.py
--- a/schema.py	Sun Mar 22 23:27:13 2015 +0100
+++ b/schema.py	Sun Mar 22 19:10:13 2015 +0100
@@ -35,7 +35,8 @@
 from yams import BadSchemaDefinition, buildobjs as ybo
 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema, \
      RelationDefinitionSchema, PermissionMixIn, role_name
-from yams.constraints import BaseConstraint, FormatConstraint
+from yams.constraints import (BaseConstraint, FormatConstraint, BoundaryConstraint,
+                              IntervalBoundConstraint, StaticVocabularyConstraint)
 from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader,
                          obsolete as yobsolete, cleanup_sys_modules,
                          fill_schema_from_namespace)
@@ -1108,6 +1109,12 @@
 
 # additional cw specific constraints ###########################################
 
+# these are implemented as CHECK constraints in sql, don't do the work
+# twice
+StaticVocabularyConstraint.check = lambda *args: True
+IntervalBoundConstraint.check = lambda *args: True
+BoundaryConstraint.check = lambda *args: True
+
 class BaseRQLConstraint(RRQLExpression, BaseConstraint):
     """base class for rql constraints"""
     distinct_query = None