Now extra spaces in user fields are discarded.

The code strips spaces at the beggining and end of user field values.
This commit is contained in:
Salvador E. Tropea 2020-08-25 09:12:46 -03:00
parent 140a45fdc6
commit d80b145af9
2 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Discarded spaces at the beggining and end of user fields when creating the
internal BoM. They are ususally mistakes that prevents grouping components.
### Fixed
- The variants logic for BoMs when a component resquested to be only added to
more than one variant.

View File

@ -774,6 +774,14 @@ class SchematicComponent(object):
comp.sheet_path_h = sheet_path_h
if GS.debug_level > 1:
logger.debug("- Loaded component {}".format(comp))
# Report abnormal situations
for field in comp.fields:
cur_val = field.value
stripped_val = cur_val.strip()
if len(cur_val) != len(stripped_val):
logger.warning("Field {} of component {} ({}) contains extra spaces: `{}` removing them.".
format(field.name, comp.ref, comp.name, field.value))
field.value = stripped_val
return comp