# HG changeset patch # User Sylvain Thénault # Date 1252665319 -7200 # Node ID 9341ab8f1d1a923cfecef66750c7beb519096acf # Parent b10f0c1f3fe4e24ce6afc97bfebf05e861213016 [vreg] we must ensure that parent classes are initialiazed first diff -r b10f0c1f3fe4 -r 9341ab8f1d1a cwvreg.py --- a/cwvreg.py Fri Sep 11 12:34:55 2009 +0200 +++ b/cwvreg.py Fri Sep 11 12:35:19 2009 +0200 @@ -130,19 +130,23 @@ baseschemas = [eschema] + eschema.ancestors() # browse ancestors from most specific to most generic and try to find an # associated custom entity class + cls = None for baseschema in baseschemas: try: btype = ETYPE_NAME_MAP[baseschema] except KeyError: btype = str(baseschema) - try: - objects = self[btype] - assert len(objects) == 1, objects - cls = objects[0] - break - except ObjectNotFound: - pass - else: + if cls is None: + try: + objects = self[btype] + assert len(objects) == 1, objects + cls = objects[0] + except ObjectNotFound: + pass + else: + # ensure parent classes are built first + self.etype_class(btype) + if cls is None: # no entity class for any of the ancestors, fallback to the default # one objects = self['Any']