need safety belt for class registered twice (during test for instance) tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 18 Feb 2009 00:30:55 +0100
branchtls-sprint
changeset 736 18c940e3f98d
parent 735 d22baa02cbaa
child 737 2494e85319fe
need safety belt for class registered twice (during test for instance)
vregistry.py
--- a/vregistry.py	Wed Feb 18 00:22:47 2009 +0100
+++ b/vregistry.py	Wed Feb 18 00:30:55 2009 +0100
@@ -131,12 +131,15 @@
         """returns a unique identifier for the vobject"""
         return '%s.%s' % (cls.__module__, cls.__name__)
 
+    # XXX bw compat code
     @classmethod
     def build___select__(cls):
         classdict = cls.__dict__
-        if '__select__' in classdict and '__selectors__' in classdict:
-            raise TypeError("__select__ and __selectors__ can't be used together")
+        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__']