# HG changeset patch # User Sylvain Thénault # Date 1267541852 -3600 # Node ID a2c73b272c9b30a8085c260324f5a279dcb99f42 # Parent 13a5d3a7410ee3dc2a3ef4cf7581e392db4f3ab4 do not check for existant entity when relation of single card is added but integrity hooks are deactivated diff -r 13a5d3a7410e -r a2c73b272c9b server/repository.py --- a/server/repository.py Tue Mar 02 15:44:26 2010 +0100 +++ b/server/repository.py Tue Mar 02 15:57:32 2010 +0100 @@ -105,7 +105,8 @@ # skip that for super session (though we can still skip it for internal # sessions). Also we should imo rely on the orm to first fetch existing # entity if any then delete it. - if session.is_internal_session: + if session.is_internal_session \ + or not session.vreg.config.is_hook_category_activated('integrity'): return card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality') # one may be tented to check for neweids but this may cause more than one diff -r 13a5d3a7410e -r a2c73b272c9b server/serverconfig.py --- a/server/serverconfig.py Tue Mar 02 15:44:26 2010 +0100 +++ b/server/serverconfig.py Tue Mar 02 15:57:32 2010 +0100 @@ -185,6 +185,8 @@ # check user's state at login time consider_user_state = True + # XXX hooks control stuff should probably be on the session, not on the config + # hooks activation configuration # all hooks should be activated during normal execution disabled_hooks_categories = set() @@ -232,9 +234,13 @@ @classmethod def is_hook_activated(cls, hook): + return cls.is_hook_category_activated(hook.category) + + @classmethod + def is_hook_category_activated(cls, category): if cls.hooks_mode is cls.DENY_ALL: - return hook.category in cls.enabled_hooks_categories - return hook.category not in cls.disabled_hooks_categories + return category in cls.enabled_hooks_categories + return category not in cls.disabled_hooks_categories # should some hooks be deactivated during [pre|post]create script execution free_wheel = False