diff options
Diffstat (limited to 'src/ee/part')
-rw-r--r-- | src/ee/part/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py index fbf0838..4354771 100644 --- a/src/ee/part/__init__.py +++ b/src/ee/part/__init__.py @@ -22,6 +22,8 @@ class Part(object): xml.linksProp = xml.linksProp if xml.linksProp is not None else types.LinkList() xml.factsProp = xml.factsProp if xml.factsProp is not None else types.FactList() + self.facts = Facts(self) + def clean_xml(self): x = self.xml if len(x.referencesProp.part_referenceProp) == 0 and \ @@ -154,6 +156,14 @@ class Part(object): return next((f for f in self.get_facts() if f.keyProp == key), None) +class Facts(object): + def __init__(self, part): + self.part = part + + def add(self, key: str, value: str, label=None): + self.part.get_facts().append(types.Fact(key=key, label=label, value=value)) + + class Entry(object): def __init__(self, new: bool, part: types.Part): self.new = new |