diff -r b70295aaed9d -r ab0cd0765076 hooks/syncschema.py --- a/hooks/syncschema.py Tue Jan 29 16:57:44 2013 +0100 +++ b/hooks/syncschema.py Mon Mar 11 14:46:09 2013 +0100 @@ -244,7 +244,7 @@ * create the necessary table * set creation_date and modification_date by creating the necessary CWAttribute entities - * add owned_by relation by creating the necessary CWRelation entity + * add relation by creating the necessary CWRelation entity """ entity = None # make pylint happy @@ -270,9 +270,16 @@ except KeyError: self.critical('rtype %s was not handled at cwetype creation time', rtype) continue + if not rschema.rdefs: + self.warning('rtype %s has no relation definition yet', rtype) + continue sampletype = rschema.subjects()[0] desttype = rschema.objects()[0] - rdef = copy(rschema.rdef(sampletype, desttype)) + try: + rdef = copy(rschema.rdef(sampletype, desttype)) + except KeyError: + # this combo does not exist because this is not a universal META_RTYPE + continue rdef.subject = _MockEntity(eid=entity.eid) mock = _MockEntity(eid=None) ss.execschemarql(session.execute, mock, ss.rdef2rql(rdef, cmap, gmap))