[3.4 migration] only set cwuri for entities from the system source
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 05 Aug 2009 17:23:06 +0200
changeset 2696 b45d852990d5
parent 2695 56439c45781c
child 2697 a0c4bc933a1b
[3.4 migration] only set cwuri for entities from the system source
misc/migration/bootstrapmigration_repository.py
--- a/misc/migration/bootstrapmigration_repository.py	Wed Aug 05 17:22:33 2009 +0200
+++ b/misc/migration/bootstrapmigration_repository.py	Wed Aug 05 17:23:06 2009 +0200
@@ -21,11 +21,10 @@
     # 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):
-        try:
+        type, source, extid = session.describe(eid)
+        if source == 'system':
             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', '')