do not check for existant entity when relation of single card is added but integrity hooks are deactivated
--- 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
--- 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