changed errortype for consistency with py default behavior
This commit is contained in:
parent
ca200b1c23
commit
72dee6dac7
|
|
@ -38,20 +38,20 @@ class environment():
|
||||||
|
|
||||||
def __getattr__(self, attribute):
|
def __getattr__(self, attribute):
|
||||||
if attribute[0] == "_":
|
if attribute[0] == "_":
|
||||||
super().__getattr__(attribute)
|
super().__getattribute__(attribute)
|
||||||
elif attribute in self._mParams:
|
elif attribute in self._mParams:
|
||||||
return self._mParams[attribute]
|
return self._mParams[attribute]
|
||||||
elif attribute in self._sParams:
|
elif attribute in self._sParams:
|
||||||
return self._sParams[attribute]
|
return self._sParams[attribute]
|
||||||
else:
|
else:
|
||||||
raise KeyError(attribute)
|
raise AttributeError(attribute)
|
||||||
|
|
||||||
def __setattr__ (self, attribute, value):
|
def __setattr__(self, attribute, value):
|
||||||
if attribute[0] == "_":
|
if attribute[0] == "_":
|
||||||
super().__setattr__(attribute, value)
|
super().__setattr__(attribute, value)
|
||||||
elif attribute in self._mParams:
|
elif attribute in self._mParams:
|
||||||
self._mParams[attribute] = value
|
self._mParams[attribute] = value
|
||||||
elif attribute in self._sParams:
|
elif attribute in self._sParams:
|
||||||
self._sParams[attribute] = value
|
self._sParams[attribute] = value
|
||||||
else:
|
else:
|
||||||
raise KeyError(attribute) #could also add attribute as a new entry
|
raise AttributeError(attribute) # Could also add attribute as a new entry
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue