Skip to content

Commit 89e8262

Browse files
committed
fix asn data mapping to model
1 parent 3aa7d90 commit 89e8262

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/stpipe/library.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ def __init__(
198198

199199
# load association
200200
asn_data = self._load_asn(asn_path)
201+
202+
# store the basename of the input file as the table_name
203+
asn_data["table_name"] = os.path.basename(asn_path)
201204
elif isinstance(init, MutableMapping):
202205
# init is an association "dictionary"
203206
# we will modify the asn below so do a deep copy
@@ -540,8 +543,10 @@ def _assign_member_to_model(self, model, member):
540543
if not hasattr(model.meta, "asn"):
541544
model.meta.asn = {}
542545

543-
model.meta.asn["table_name"] = self.asn.get("table_name", "")
544-
model.meta.asn["pool_name"] = self.asn.get("asn_pool", "")
546+
if "table_name" in self.asn:
547+
model.meta.asn["table_name"] = self.asn["table_name"]
548+
if "asn_pool" in self.asn:
549+
model.meta.asn["pool_name"] = self.asn["asn_pool"]
545550

546551
def _load_member(self, index):
547552
"""

0 commit comments

Comments
 (0)