python: ConfigInfo: return None from constructor if not available.
This commit is contained in:
parent
8593c8e30d
commit
14e8eb3353
|
@ -525,9 +525,14 @@ class Output(object):
|
||||||
|
|
||||||
class ConfigInfo(object):
|
class ConfigInfo(object):
|
||||||
|
|
||||||
def __init__(self, key):
|
def __new__(cls, key):
|
||||||
self.key = key
|
struct = sr_config_info_get(key.id)
|
||||||
self.struct = sr_config_info_get(key.id)
|
if not struct:
|
||||||
|
return None
|
||||||
|
obj = super(ConfigInfo, cls).__new__(cls)
|
||||||
|
obj.key = key
|
||||||
|
obj.struct = struct
|
||||||
|
return obj
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def datatype(self):
|
def datatype(self):
|
||||||
|
|
Loading…
Reference in New Issue