equal
deleted
inserted
replaced
45 |
45 |
46 from cubicweb.server import debugged |
46 from cubicweb.server import debugged |
47 todelete = {} |
47 todelete = {} |
48 host = source.config['base-url'].split('://')[1] |
48 host = source.config['base-url'].split('://')[1] |
49 for entity in rql('Any X WHERE X cw_source S, S eid %(s)s', {'s': source.eid}).entities(): |
49 for entity in rql('Any X WHERE X cw_source S, S eid %(s)s', {'s': source.eid}).entities(): |
50 etype = entity.__regid__ |
50 etype = entity.cw_etype |
51 if not source.support_entity(etype): |
51 if not source.support_entity(etype): |
52 print "source doesn't support %s, delete %s" % (etype, entity.eid) |
52 print "source doesn't support %s, delete %s" % (etype, entity.eid) |
53 elif etype in DONT_GET_BACK_ETYPES: |
53 elif etype in DONT_GET_BACK_ETYPES: |
54 print 'ignore %s, delete %s' % (etype, entity.eid) |
54 print 'ignore %s, delete %s' % (etype, entity.eid) |
55 else: |
55 else: |
82 session.disable_hook_categories('cw.sources') |
82 session.disable_hook_categories('cw.sources') |
83 mapping = [] |
83 mapping = [] |
84 for mappart in rql('Any X,SCH WHERE X cw_schema SCH, X cw_for_source S, S eid %(s)s', |
84 for mappart in rql('Any X,SCH WHERE X cw_schema SCH, X cw_for_source S, S eid %(s)s', |
85 {'s': source.eid}).entities(): |
85 {'s': source.eid}).entities(): |
86 schemaent = mappart.cw_schema[0] |
86 schemaent = mappart.cw_schema[0] |
87 if schemaent.__regid__ != 'CWEType': |
87 if schemaent.cw_etype != 'CWEType': |
88 assert schemaent.__regid__ == 'CWRType' |
88 assert schemaent.cw_etype == 'CWRType' |
89 sch = schema._eid_index[schemaent.eid] |
89 sch = schema._eid_index[schemaent.eid] |
90 for rdef in sch.rdefs.itervalues(): |
90 for rdef in sch.rdefs.itervalues(): |
91 if not source.support_entity(rdef.subject) \ |
91 if not source.support_entity(rdef.subject) \ |
92 or not source.support_entity(rdef.object): |
92 or not source.support_entity(rdef.object): |
93 continue |
93 continue |