diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-26 16:49:23 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-26 16:49:23 +0200 |
commit | 88e878626eac92d255b763b1ba5da5b393bfdc2f (patch) | |
tree | 4c0e30149850ede9e577f81e6a992703a2318977 /src | |
parent | 83ce033d6413b44bc30d52043b138b449b2db3c2 (diff) | |
download | ee-python-88e878626eac92d255b763b1ba5da5b393bfdc2f.tar.gz ee-python-88e878626eac92d255b763b1ba5da5b393bfdc2f.tar.bz2 ee-python-88e878626eac92d255b763b1ba5da5b393bfdc2f.tar.xz ee-python-88e878626eac92d255b763b1ba5da5b393bfdc2f.zip |
o Stripping field values, setting to None if emtpy.
Diffstat (limited to 'src')
-rw-r--r-- | src/ee/kicad/model.py | 2 | ||||
-rw-r--r-- | src/ee/kicad/to_bom.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/ee/kicad/model.py b/src/ee/kicad/model.py index b230f94..a9b0c02 100644 --- a/src/ee/kicad/model.py +++ b/src/ee/kicad/model.py @@ -22,6 +22,8 @@ class ComponentField(object): names = ["Reference", "Value", "Footprint", "Datasheet"] def __init__(self, index, name, value, position): + value = value.strip() if value and len(value.strip()) > 0 else None + self._index = index self._name = name if index >= len(ComponentField.names) else ComponentField.names[index] self._value = value diff --git a/src/ee/kicad/to_bom.py b/src/ee/kicad/to_bom.py index ecab211..9a4f950 100644 --- a/src/ee/kicad/to_bom.py +++ b/src/ee/kicad/to_bom.py @@ -5,7 +5,7 @@ __all__ = ["to_bom"] def simple_element(parent, e, text): - if len(text) == 0: + if not text or len(text) == 0: return element = Element(e) element.text = text |