Skip to content

Commit

Permalink
strip() on all entry for new version 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
prrvchr committed Jun 22, 2020
1 parent 4fe7006 commit e3a56c5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bom-cpl-plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@ def __init__(self, component):
self.ref = component.attrib['ref']
value = component.find('value')
if value is not None:
self.value = value.text
self.value = value.text.strip()
else:
self.value = ''
footprint = component.find('footprint')
if footprint is not None:
self.footprint = footprint.text.split(':').pop()
self.footprint = footprint.text.strip().split(':').pop()
else:
self.footprint = ''
supplier = component.find('./fields/field[@name="Supplier"]')
if supplier is not None:
self._supplier = supplier.text
self._supplier = supplier.text.strip()
else:
self._supplier = ''
self.Manufacturer = ''
Expand Down Expand Up @@ -229,23 +229,23 @@ def __lt__(self, other):
def setCustomFields(self, fields, suppliers):
manufacturer = fields.find('./field[@name="Manufacturer"]')
if manufacturer is not None:
self.Manufacturer = manufacturer.text
self.Manufacturer = manufacturer.text.strip()
partnumber = fields.find('./field[@name="PartNumber"]')
if partnumber is not None:
self.PartNumber = partnumber.text
self.PartNumber = partnumber.text.strip()
reference = fields.find('./field[@name="%sRef"]' % self._supplier)
if reference is not None:
self.SupplierRef = reference.text
self.SupplierRef = reference.text.strip()
else:
reference = fields.find('./field[@name="SupplierRef"]')
if reference is not None:
self.SupplierRef = reference.text
self.SupplierRef = reference.text.strip()
rotation = fields.find('./field[@name="Rotation"]')
if rotation is not None:
self.Rotation = getInteger(rotation.text, 0)
self.Rotation = getInteger(rotation.text.strip(), 0)
quantity = fields.find('./field[@name="Quantity"]')
if quantity is not None:
self.Quantity = getInteger(quantity.text, 0, 0)
self.Quantity = getInteger(quantity.text.strip(), 0, 0)
if all((getattr(self, a) for a in getValid(self.Supplier))):
if self.Supplier not in suppliers:
suppliers.append(self.Supplier)
Expand Down

0 comments on commit e3a56c5

Please sign in to comment.