use inspect

This commit is contained in:
Michael Davidsaver
2018-01-24 15:48:56 -08:00
parent ab867e3bee
commit d6685b49b9

View File

@ -3,7 +3,7 @@
import logging import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
import threading import threading, inspect
_tables = {} _tables = {}
@ -298,7 +298,7 @@ class TableBase(object):
# and place appropriate things in the instance dictionary # and place appropriate things in the instance dictionary
rparams = {} rparams = {}
rgroups = {} rgroups = {}
for k,v in self.__class__.__dict__.items(): for k,v in inspect.getmembers(self):
if isinstance(v, Parameter): if isinstance(v, Parameter):
scan = None scan = None
if not v.name: if not v.name:
@ -324,7 +324,7 @@ class TableBase(object):
P._groups.add(G) P._groups.add(G)
# second pass to attach actions # second pass to attach actions
for k,v in self.__class__.__dict__.items(): for k,v in inspect.getmembers(self):
if hasattr(v, '_ptable_action'): if hasattr(v, '_ptable_action'):
for src,cond,cmeth in v._ptable_action: for src,cond,cmeth in v._ptable_action:
# src is instance parameter or group # src is instance parameter or group