• Arnaud Fontaine's avatar
    WIP: Portal Type as Classes: ERP5Form: Instances of Documents should never be created directly. · b30d9285
    Arnaud Fontaine authored
    This has been banned since the introduction of Portal Type class. When creating
    a new ERP5Form via addERP5Form/ZMI, its MRO:
      * Before:
        <class 'Products.ERP5Form.Form.ERP5Form'>
        <class 'Products.ERP5Type.Base.Base'>
        ...
        <type 'ExtensionClass.Base'>
      * Now:
        <class 'erp5.portal_type.ERP5 Form'>,
        <class 'Products.ERP5Form.Form.ERP5Form'>,
        <class 'Products.ERP5Type.Base.Base'>,
        ...
        <class 'erp5.accessor_holder.property_sheet.SimpleItem'>
        <class 'erp5.accessor_holder.property_sheet.Folder'>
        <class 'erp5.accessor_holder.property_sheet.Base'>
        <class 'erp5.accessor_holder.property_sheet.CategoryCore'>
        <class 'erp5.accessor_holder.BaseAccessorHolder'>
        <class 'Products.ERP5Type.dynamic.portal_type_class.GetAcquireLocalRolesMixIn'>
        <type 'ExtensionClass.Base'>
    
    Thus it was missing many accessors and was working only by chance (or at least
    unless these accessors were not called until the object was automatically migrated
    by the next call to __setstate__). Namely, as `providesI*` accessors are now in
    BaseAccessorHolder rather than Base due to ZODB Components, this breaks reindexing
    (`AttributeError: providesIPredicate`).
    
    Also, remove hardcoded _getAcquireLocalRoles() now that it is not used as a regular
    class anymore. Set this on the portal type object instead.
    
    TODO: Add commit IDs of:
      * ZODB Components: providesIFoo() getters were only created for FS Interfaces.
      * erp5_certificate_authority: Certificate Authortiy Tool: All ERP5 objects *must* have have a Portal Type in Types Tool.
    b30d9285
testListBox.py 30.4 KB