• Sebastien Robin's avatar
    ERP5Type.dynamic: show up failures in __getattribute__ of lazy_class · d032411c
    Sebastien Robin authored
    If for some reasons loadClass was not working, it was failing totally
    silently without any log. If there is any unexpected error in loadClass,
    this ended up for example having some tests failing with :
    
    RuntimeError: Malformed property definition <persistent broken
    erp5.portal_type.Acquired Property instance '\x00\x00\x00\x00\x00\x00\x12\xb5'>
    on /erp5/portal_property_sheets/SimpleItem
    
    While only this was displayed in logs :
    
    ERP5Type/dynamic/lazy_class.py", line 350, in loadClass
        class_definition = generatePortalTypeClass(site, portal_type)
    ...
    AttributeError: __of__
    
    Which was totally unrelated to the real problem.
    
    So a silent initial error was the source of later unrelated errors, making
    it very difficult to find the initial source of problem.
    
    So make sure we have logs as soon as we are not able to load a class.
    d032411c