Skip to content

Commit

Permalink
cline -- handle case of trying to retrieve a non-existent default
Browse files Browse the repository at this point in the history
  • Loading branch information
trmrsh committed Mar 17, 2021
1 parent e634a25 commit 4a064c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hipercam/cline.py
Expand Up @@ -469,17 +469,18 @@ def set_default(self, param, defval):

def get_default(self, param):
"""
Gets the current default value of a parameter called 'param'
Gets the current default value of a parameter called 'param'. Can come back None
if there is no value set.
"""
if param not in self._rpars:
raise ClineError(
'set_default: parameter = "' + param + '" has not been registered.'
)

if self._rpars[param]["g_or_l"] == Cline.GLOBAL:
defval = self._gpars[param]
defval = self._gpars.get(param,None)
else:
defval = self._lpars[param]
defval = self._lpars.get(param,None)
return defval

def get_value(
Expand Down

0 comments on commit 4a064c7

Please sign in to comment.