server/checkintegrity.py
branchstable
changeset 8527 6151b0199bc1
parent 8450 11063635c4e4
child 8562 0d2fb4604265
equal deleted inserted replaced
8526:ed0fbbf507bb 8527:6151b0199bc1
   315 def check_mandatory_relations(schema, session, eids, fix=1):
   315 def check_mandatory_relations(schema, session, eids, fix=1):
   316     """check entities missing some mandatory relation"""
   316     """check entities missing some mandatory relation"""
   317     print 'Checking mandatory relations'
   317     print 'Checking mandatory relations'
   318     msg = '%s #%s is missing mandatory %s relation %s (autofix will delete the entity)'
   318     msg = '%s #%s is missing mandatory %s relation %s (autofix will delete the entity)'
   319     for rschema in schema.relations():
   319     for rschema in schema.relations():
   320         if rschema.final or rschema.type in PURE_VIRTUAL_RTYPES:
   320         if rschema.final or rschema in PURE_VIRTUAL_RTYPES or rschema in ('is', 'is_instance_of'):
   321             continue
   321             continue
   322         smandatory = set()
   322         smandatory = set()
   323         omandatory = set()
   323         omandatory = set()
   324         for rdef in rschema.rdefs.values():
   324         for rdef in rschema.rdefs.values():
   325             if rdef.cardinality[0] in '1+':
   325             if rdef.cardinality[0] in '1+':