Skip to content

Commit

Permalink
Merge pull request #199 from INTI-CMNB/fix_changing_fields
Browse files Browse the repository at this point in the history
Fixed changing field values via the complex_variant option
  • Loading branch information
SchrodingersGat authored Jan 10, 2024
2 parents 519dd24 + c73c665 commit 6a53771
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kibom/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,17 @@ def getValueSort(self):
def setField(self, name, value):
""" Set the value of the specified field """

name = name.lower()
# Description field
doc = self.element.getChild('libsource')
if doc:
for att_name, att_value in doc.attributes.items():
if att_name.lower() == name.lower():
if att_name.lower() == name:
doc.attributes[att_name] = value
return value

# Common fields
field = self.element.getChild(name.lower())
field = self.element.getChild(name)
if field:
field.setChars(value)
return value
Expand All @@ -258,7 +259,7 @@ def setField(self, name, value):
fields = self.element.getChild('fields')
if fields:
for field in fields.getChildren():
if field.get('field', 'name') == name:
if field.get('field', 'name').lower() == name:
field.setChars(value)
return value

Expand Down

0 comments on commit 6a53771

Please sign in to comment.