misc/scripts/pyroforge2datafeed.py
changeset 8696 0bb18407c053
parent 8008 9489dc9bc114
child 8900 010a59e12d89
equal deleted inserted replaced
8695:358d8bed9626 8696:0bb18407c053
    72                 continue
    72                 continue
    73         todelete.setdefault(etype, []).append(entity)
    73         todelete.setdefault(etype, []).append(entity)
    74 
    74 
    75 # only cleanup entities table, remaining stuff should be cleaned by a c-c
    75 # only cleanup entities table, remaining stuff should be cleaned by a c-c
    76 # db-check to be run after this script
    76 # db-check to be run after this script
    77 for entities in todelete.values():
    77 for entities in todelete.itervalues():
    78     system_source.delete_info_multi(session, entities, source_name)
    78     system_source.delete_info_multi(session, entities, source_name)
    79 
    79 
    80 
    80 
    81 print '******************** backport mapping **********************************'
    81 print '******************** backport mapping **********************************'
    82 session.disable_hook_categories('cw.sources')
    82 session.disable_hook_categories('cw.sources')
    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.__regid__ != 'CWEType':
    88         assert schemaent.__regid__ == 'CWRType'
    88         assert schemaent.__regid__ == 'CWRType'
    89         sch = schema._eid_index[schemaent.eid]
    89         sch = schema._eid_index[schemaent.eid]
    90         for rdef in sch.rdefs.values():
    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
    94             if rdef.subject in DONT_GET_BACK_ETYPES \
    94             if rdef.subject in DONT_GET_BACK_ETYPES \
    95                     and rdef.object in DONT_GET_BACK_ETYPES:
    95                     and rdef.object in DONT_GET_BACK_ETYPES: