vregistry.py
branchtls-sprint
changeset 943 9fdfa8d38359
parent 835 7dcb11dd443e
child 946 a130b5ceeca9
--- a/vregistry.py	Tue Feb 24 12:00:01 2009 +0100
+++ b/vregistry.py	Tue Feb 24 16:12:19 2009 +0100
@@ -126,22 +126,25 @@
     # XXX bw compat code
     @classmethod
     def build___select__(cls):
-        classdict = cls.__dict__
-        if ('__select__' in classdict and '__selectors__' in classdict
-            and not '__selgenerated__' in classdict):
-            raise TypeError("__select__ and __selectors__ can't be used together on class %s" % cls)
-        if '__selectors__' in classdict:
-            cls.__selgenerated__ = True
-            # case where __selectors__ is defined locally (but __select__
-            # is in a parent class)
-            selectors = classdict['__selectors__']
-            if len(selectors) == 1:
-                # micro optimization: don't bother with AndSelector if there's
-                # only one selector
-                select = _instantiate_selector(selectors[0])
-            else:
-                select = AndSelector(*selectors)
-            cls.__select__ = select
+        for klass in cls.mro():
+            if klass.__name__ == 'AppRsetObject':
+                continue # the bw compat __selector__ is there
+            klassdict = klass.__dict__
+            if ('__select__' in klassdict and '__selectors__' in klassdict
+                and '__selgenerated__' not in klassdict):
+                raise TypeError("__select__ and __selectors__ can't be used together on class %s" % cls)
+            if '__selectors__' in klassdict and '__selgenerated__' not in klassdict:
+                cls.__selgenerated__ = True
+                # case where __selectors__ is defined locally (but __select__
+                # is in a parent class)
+                selectors = klassdict['__selectors__']
+                if len(selectors) == 1:
+                    # micro optimization: don't bother with AndSelector if there's
+                    # only one selector
+                    select = _instantiate_selector(selectors[0])
+                else:
+                    select = AndSelector(*selectors)
+                cls.__select__ = select
 
 
 class VRegistry(object):