diff options
Diffstat (limited to 'src/ee/part/excel.py')
-rw-r--r-- | src/ee/part/excel.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ee/part/excel.py b/src/ee/part/excel.py index 12b583d..b0c4a2b 100644 --- a/src/ee/part/excel.py +++ b/src/ee/part/excel.py @@ -1,3 +1,4 @@ +import uuid from pathlib import Path from typing import Optional, Mapping @@ -38,12 +39,12 @@ def from_excel(path: Path, sheet_name: Optional[str]) -> PartDb: print("Bad part, line #{}. MPN or description is required".format(idx)) continue - part = Part(types.Part()) + uri = "urn:uuid:{}".format(uuid.uuid5(uuid.NAMESPACE_URL, url)) + part = Part(types.Part(uri=uri)) - if not mpn: - mpn = desc.replace(" ", "-").lower() + if mpn: + part.add_mpn(mpn) - part.add_mpn(mpn) part.xml.descriptionProp = desc if price: |