check entity's cwuri and remove debug stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Sat, 22 Oct 2011 11:59:42 +0200
branchstable
changeset 8008 9489dc9bc114
parent 7987 0977d9594d3c
child 8010 75b6005eb590
check entity's cwuri and remove debug
misc/scripts/pyroforge2datafeed.py
--- a/misc/scripts/pyroforge2datafeed.py	Fri Oct 21 13:05:26 2011 +0200
+++ b/misc/scripts/pyroforge2datafeed.py	Sat Oct 22 11:59:42 2011 +0200
@@ -45,8 +45,8 @@
 
 from cubicweb.server import debugged
 todelete = {}
+host = source.config['base-url'].split('://')[1]
 for entity in rql('Any X WHERE X cw_source S, S eid %(s)s', {'s': source.eid}).entities():
-    with debugged('DBG_SQL'):
         etype = entity.__regid__
         if not source.support_entity(etype):
             print "source doesn't support %s, delete %s" % (etype, entity.eid)
@@ -55,7 +55,10 @@
         else:
             try:
                 entity.complete()
-            except:
+                if not host in entity.cwuri:
+                    print 'SKIP foreign entity', entity.cwuri, source.config['base-url']
+                    continue
+            except Exception:
                 print '%s %s much probably deleted, delete it (extid %s)' % (
                     etype, entity.eid, entity.cw_metainformation()['extid'])
             else: