Skip to content

Commit

Permalink
#41: convert CommonNames to string
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Mar 18, 2024
1 parent 8015ca7 commit 2121406
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions basico/model_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4670,14 +4670,16 @@ def _get_group_as_dict(group, basic_only=True, dm=None):
result[name] = param.getBoolValue()
elif param_type == COPASI.CCopasiParameter.Type_CN:
cn = param.getCNValue()
if dm is not None:
if cn.getString() != '' and dm is not None:
obj = dm.getObject(cn)
if obj is not None:
named = obj.getObjectDisplayName()
if dm.findObjectByDisplayName(named) is not None:
cn = named
else:
logger.warning('could not find object with CN {0}'.format(cn))
if isinstance(cn, COPASI.CCommonName):
cn = cn.getString()
result[name] = cn

return result
Expand Down Expand Up @@ -4721,7 +4723,7 @@ def _set_group_from_dict(group, values, dm=None):
elif param_type == COPASI.CCopasiParameter.Type_CN:
name_or_cn = str(values[key])
if dm is not None:
obj = dm.getObject(name_or_cn)
obj = dm.getObject(COPASI.CCommonName(name_or_cn))
if obj is None:
obj = dm.findObjectByDisplayName(name_or_cn)

Expand Down

0 comments on commit 2121406

Please sign in to comment.