# HG changeset patch # User Sylvain Thénault # Date 1269971720 -7200 # Node ID 8c39d2bf58fdb6d8887a1a498e310955451e6750 # Parent 192ebe96977903750657939e020faf0c2daac4c5 [repo creation] removing existing entities of 'single' cardinality relatino should be considered as 'activeintegrity' hook. Also don't disable that category during repo creation to avoid pb such as two default workflows for one entity types diff -r 192ebe969779 -r 8c39d2bf58fd server/__init__.py --- a/server/__init__.py Tue Mar 30 17:59:18 2010 +0200 +++ b/server/__init__.py Tue Mar 30 19:55:20 2010 +0200 @@ -210,8 +210,11 @@ paths = [p for p in config.cubes_path() + [config.apphome] if exists(join(p, 'migration'))] # deactivate every hooks but those responsible to set metadata - # so, NO INTEGRITY CHECKS are done, to have quicker db creation - with hooks_control(session, session.HOOKS_DENY_ALL, 'metadata'): + # so, NO INTEGRITY CHECKS are done, to have quicker db creation. + # Active integrity is kept else we may pb such as two default + # workflows for one entity type. + with hooks_control(session, session.HOOKS_DENY_ALL, 'metadata', + 'activeintegrity'): # execute cubicweb's pre script mhandler.exec_event_script('pre%s' % event) # execute cubes pre script if any diff -r 192ebe969779 -r 8c39d2bf58fd server/repository.py --- a/server/repository.py Tue Mar 30 17:59:18 2010 +0200 +++ b/server/repository.py Tue Mar 30 19:55:20 2010 +0200 @@ -59,7 +59,7 @@ # XXX we should imo rely on the orm to first fetch existing entity if any # then delete it. if session.is_internal_session \ - or not session.is_hook_category_activated('integrity'): + or not session.is_hook_category_activated('activeintegrity'): return card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality') # one may be tented to check for neweids but this may cause more than one