--- a/appobject.py Mon May 16 11:36:42 2011 +0200
+++ b/appobject.py Thu Apr 28 17:05:22 2011 +0200
@@ -180,12 +180,13 @@
return self.__class__.__name__
def search_selector(self, selector):
- """search for the given selector or selector instance in the selectors
- tree. Return it of None if not found
+ """search for the given selector, selector instance or tuple of
+ selectors in the selectors tree. Return None if not found.
"""
if self is selector:
return self
- if isinstance(selector, type) and isinstance(self, selector):
+ if (isinstance(selector, type) or isinstance(selector, tuple)) and \
+ isinstance(self, selector):
return self
return None
@@ -250,8 +251,8 @@
return merged_selectors
def search_selector(self, selector):
- """search for the given selector or selector instance in the selectors
- tree. Return it of None if not found
+ """search for the given selector or selector instance (or tuple of
+ selectors) in the selectors tree. Return None if not found
"""
for childselector in self.selectors:
if childselector is selector:
@@ -259,7 +260,8 @@
found = childselector.search_selector(selector)
if found is not None:
return found
- return None
+ # if not found in children, maybe we are looking for self?
+ return super(MultiSelector, self).search_selector(selector)
class AndSelector(MultiSelector):