Skip to content

Commit a9371d4

Browse files
authored
create placeholder facts if they're None when creating relationships (#3248)
* create placeholder facts if they're None when creating relationships * use relationship constructor to set default facts Fixes #3247
1 parent 20bfc01 commit a9371d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/objects/secondclass/c_relationship.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import marshmallow as ma
22

33
from app.utility.base_object import BaseObject
4-
from app.objects.secondclass.c_fact import FactSchema
4+
from app.objects.secondclass.c_fact import Fact, FactSchema
55

66

77
class RelationshipSchema(ma.Schema):
@@ -68,8 +68,8 @@ def shorthand(self):
6868

6969
def __init__(self, source, edge=None, target=None, score=1, origin=None):
7070
super().__init__()
71-
self.source = source
71+
self.source = source or Fact('', None)
7272
self.edge = edge
73-
self.target = target
73+
self.target = target or Fact('', None)
7474
self.score = score
7575
self.origin = origin

0 commit comments

Comments
 (0)