# HG changeset patch # User Sylvain Thénault # Date 1285924165 -7200 # Node ID df4fd2a1b0e76964ff74e93b6152d994349831be # Parent 5adf53edfe125865a1b409a09a8683de692a7874 [schema] introduce new WORKFLOW_RTYPES set and use it to build SYSTEM_RTYPES/DONT_CHECK_RTYPES_ON_ADD/DONT_CHECK_RTYPES_ON_DEL sets diff -r 5adf53edfe12 -r df4fd2a1b0e7 hooks/integrity.py --- a/hooks/integrity.py Fri Oct 01 11:08:31 2010 +0200 +++ b/hooks/integrity.py Fri Oct 01 11:09:25 2010 +0200 @@ -26,7 +26,8 @@ from yams.schema import role_name from cubicweb import ValidationError -from cubicweb.schema import RQLConstraint, RQLUniqueConstraint +from cubicweb.schema import (META_RTYPES, WORKFLOW_RTYPES, + RQLConstraint, RQLUniqueConstraint) from cubicweb.selectors import is_instance from cubicweb.uilib import soup2xhtml from cubicweb.server import hook @@ -34,11 +35,8 @@ # special relations that don't have to be checked for integrity, usually # because they are handled internally by hooks (so we trust ourselves) -DONT_CHECK_RTYPES_ON_ADD = set(('owned_by', 'created_by', - 'is', 'is_instance_of', - 'wf_info_for', 'from_state', 'to_state')) -DONT_CHECK_RTYPES_ON_DEL = set(('is', 'is_instance_of', - 'wf_info_for', 'from_state', 'to_state')) +DONT_CHECK_RTYPES_ON_ADD = META_RTYPES | WORKFLOW_RTYPES +DONT_CHECK_RTYPES_ON_DEL = META_RTYPES | WORKFLOW_RTYPES _UNIQUE_CONSTRAINTS_LOCK = Lock() _UNIQUE_CONSTRAINTS_HOLDER = None diff -r 5adf53edfe12 -r df4fd2a1b0e7 schema.py --- a/schema.py Fri Oct 01 11:08:31 2010 +0200 +++ b/schema.py Fri Oct 01 11:09:25 2010 +0200 @@ -51,8 +51,8 @@ 'owned_by', 'created_by', 'is', 'is_instance_of', 'identity', 'eid', 'creation_date', 'modification_date', 'has_text', 'cwuri', )) -SYSTEM_RTYPES = set(('require_permission', 'custom_workflow', 'in_state', - 'wf_info_for')) +WORKFLOW_RTYPES = set(('custom_workflow', 'in_state', 'wf_info_for')) +SYSTEM_RTYPES = set(('require_permission',)) | WORKFLOW_RTYPES # set of entity and relation types used to build the schema SCHEMA_TYPES = set((