fix so that we ensure issubclass(etype_class('SubNote'), etype_class('Note')) 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 09 Sep 2009 15:12:23 +0200
branch3.5
changeset 3137 5598bec9be7f
parent 3136 ed303cf3a048
child 3139 c527984d6651
fix so that we ensure issubclass(etype_class('SubNote'), etype_class('Note'))
cwvreg.py
--- a/cwvreg.py	Wed Sep 09 15:07:58 2009 +0200
+++ b/cwvreg.py	Wed Sep 09 15:12:23 2009 +0200
@@ -138,7 +138,12 @@
             try:
                 objects = self[btype]
                 assert len(objects) == 1, objects
-                cls = objects[0]
+                if btype == etype:
+                    cls = objects[0]
+                else:
+                    # recurse to ensure issubclass(etype_class('Child'),
+                    #                              etype_class('Parent'))
+                    cls = self.etype_class(btype)
                 break
             except ObjectNotFound:
                 pass