def get_trace_component_for_rule(rule_db, trigger_instance_db):
 trace_component = {}
 trace_component = {'id': str(rule_db.id), 'ref': rule_db.ref}
 caused_by = {}
 if trigger_instance_db:
  caused_by['type'] = 'trigger_instance'
  caused_by['id'] = str(trigger_instance_db.id)
 trace_component['caused_by'] = caused_by
 return trace_component

def get_trace_component_for_rule ( rule_db , trigger_instance_db ) : trace_component = { } trace_component = { 'id' : str ( rule_db . id ) , 'ref' : rule_db . ref } caused_by = { } if trigger_instance_db : caused_by [ 'type' ] = 'trigger_instance' caused_by [ 'id' ] = str ( trigger_instance_db . id ) trace_component [ 'caused_by' ] = caused_by return trace_component
returns the trace_component compatible dict representation of a rule .