Modified:
    trunk/src/robot/running/testlibraries.py
Log:
refactoring
Modified: trunk/src/robot/running/testlibraries.py
==============================================================================
--- trunk/src/robot/running/testlibraries.py	(original)
+++ trunk/src/robot/running/testlibraries.py	Mon Jan 12 13:59:18 2009
@@ -228,24 +228,22 @@
          # importantly bean properties generated by Jython (issue 188).
          for item in (libcode,) + inspect.getmro(libcode.__class__):
              try:
-                attr = item.__dict__[name]
-                if self._isroutine(attr) and \
-                     (item is libcode or self._is_valid_handler(item,  
attr)):
+                if self._is_valid_handler(item.__dict__[name], item,  
libcode):
                      return getattr(libcode, name)
              except (KeyError, AttributeError):
                  # Java classes don't always have __dict__
                  pass
          raise TypeError('Not a method or function')
-    def _isroutine(self, item):
-        return inspect.isroutine(item) \
-                or (utils.is_jython and isinstance(item,  
PyReflectedFunction))
-
-    def _is_valid_handler(self, handler_class, handler):
+    def _is_valid_handler(self, handler, handler_parent, libcode):
          "Filters methods defined in java.lang.Object or generated by  
Jython."
+        if inspect.isroutine(handler):
+            return True
          if not utils.is_jython or not isinstance(handler,  
PyReflectedFunction):
+            return False
+        if handler_parent is libcode:
              return True
-        if handler_class is Object:
+        if handler_parent is Object:
              return False
          # signature is an instance of org.python.ReflectedArgs
          for signature in handler.argslist[:handler.nargs]: