• Arnaud Fontaine's avatar
    Portal Type as Classes: ERP5Form: Instances of Documents should never be created directly. · e791d08a
    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.
    e791d08a
testProxify.py 10.7 KB