Skip to content

Commit

Permalink
SCTE35Base.load() now validates key before updating self
Browse files Browse the repository at this point in the history
  • Loading branch information
futzu authored Nov 26, 2024
1 parent ee0b23e commit 383fc0e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions threefive/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def b2l(val):
def has(self, what):
"""
has runs hasattr with self and what
and checks if it's set.
"""
if hasattr(self, what):
if vars(self)[what]:
Expand Down Expand Up @@ -161,7 +160,8 @@ def load(self, stuff):
if isinstance(stuff, str):
stuff = json.loads(stuff)
if isinstance(stuff, dict):
prevars= vars(self)
for k, v in stuff.items():
if self.has(k):
if k in prevars:
self.__dict__[k] = v
# self.__dict__.update(stuff)
#self.__dict__.update(stuff)

0 comments on commit 383fc0e

Please sign in to comment.