diff options
author | Nagappan <nagapan@gmail.com> | 2010-04-14 03:41:41 -0700 |
---|---|---|
committer | Nagappan <nagapan@gmail.com> | 2010-04-14 03:41:41 -0700 |
commit | e9802faa9caf5d03bbab538868e901b2b14078a1 (patch) | |
tree | 4275d091d5aaa09cf809a7d3163e964fc28bc41f | |
parent | 89607e76b487ccd2061e9e6cfc039823fcdd8e82 (diff) |
populate appropriate ldtp functions
-rw-r--r-- | ooldtp/_context.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/ooldtp/_context.py b/ooldtp/_context.py index b929e1b..38960f1 100644 --- a/ooldtp/_context.py +++ b/ooldtp/_context.py @@ -32,7 +32,10 @@ class _Wrapper(object): d = ldtp.__dict__ cls._wrapped_methods =[] for attr in d: - if cls._isRemoteMethod(d[attr]):# and cls._isRelevant(d[attr]): + # Don't populate function name in ldtp module + # starting with _ + if type(attr) == str and attr[0] != '_' and \ + cls._isRemoteMethod(d[attr]): setted = attr if hasattr(cls, attr): setted = "_remote_"+setted @@ -48,7 +51,9 @@ class _Wrapper(object): return obj def _isRemoteMethod(cls, obj): - return hasattr(obj, '_Method__name') + return hasattr(obj, '_Method__name') or \ + hasattr(obj, 'func_name') + _isRemoteMethod = classmethod(_isRemoteMethod) def _listArgs(cls, func): @@ -70,11 +75,6 @@ class Context(_Wrapper): def _wrapMethod(self, obj): return _ContextFuncWrapper(self._window_name, obj) - def _isRelevant(cls, obj): - args = cls._listArgs(obj) - return args and 'window_name' == args[0] - _isRelevant = classmethod(_isRelevant) - def getchild(self, child_name='', role=''): # TODO: Bad API choice. Inconsistent, should return object or list, # not both. UPDATE: Only returns first match. @@ -133,12 +133,6 @@ class Component(_Wrapper): return _ComponentFuncWrapper( self._window_name, self._object_name, func) - def _isRelevant(cls, obj): - args = cls._listArgs(obj) - return len(args) >= 2 and \ - 'window_name' == args[0] and 'object_name' == args[1] - _isRelevant = classmethod(_isRelevant) - class _ComponentFuncWrapper: def __init__(self, window_name, object_name, func): self._window_name = window_name |