# HG changeset patch # User Sylvain Thénault # Date 1248441160 -7200 # Node ID a04caff1322ee3eb7000f6a1791576daaea397a8 # Parent 1c697cc6dd313e255a83c29d3efc47b75eba7395 take care of sources with no write support (eg ldapuser) diff -r 1c697cc6dd31 -r a04caff1322e misc/migration/bootstrapmigration_repository.py --- a/misc/migration/bootstrapmigration_repository.py Fri Jul 24 15:12:13 2009 +0200 +++ b/misc/migration/bootstrapmigration_repository.py Fri Jul 24 15:12:40 2009 +0200 @@ -11,6 +11,7 @@ applcubicwebversion, cubicwebversion = versions_map['cubicweb'] if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0): + from cubicweb import RepositoryError from cubicweb.server.hooks import uniquecstrcheck_before_modification session.set_shared_data('do-not-insert-cwuri', True) repo.hm.unregister_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') @@ -20,8 +21,11 @@ # use an internal session since some entity might forbid modifications to admin isession = repo.internal_session() for eid, in rql('Any X', ask_confirm=False): - isession.execute('SET X cwuri %(u)s WHERE X eid %(x)s', - {'x': eid, 'u': base_url + u'eid/%s' % eid}) + try: + isession.execute('SET X cwuri %(u)s WHERE X eid %(x)s', + {'x': eid, 'u': base_url + u'eid/%s' % eid}) + except RepositoryError: + print 'unable to set cwuri for', eid, session.describe(eid) isession.commit() repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_update_entity', '')