• Arnaud Fontaine's avatar
    ZODB Components: Properly handle addition of template_* properties in... · d9627917
    Arnaud Fontaine authored
    ZODB Components: Properly handle addition of template_* properties in BusinessTemplate PropertySheet.
    
    On the plus side, this avoids an ugly 'except AttributeError: pass' which does
    not work anyway with the scenario below.
    
    Assuming the following:
      * template_XXX Property (accessor: getTemplateXXX) recently added to BusinessTemplate PropertySheet.
      * erp5_YYY sets template_A Property (erp5_YYY/bt/template_XXX.xml).
      This commit handles the following:
        1. Stop instance with old ERP5 without template_XXX.
        2. Update erp5.git.
        3. Start instance.
        4. Upgrade erp5_property_sheets and erp5_YYY bt5s in *one* transaction from portal_templates UI.
        => When upgrading erp5_YYY, BusinessTemplate.importFile() imports erp5_YYY/bt/*.xml where the
           list of files is based on BusinessTemplate class propertyMap(), but at this point accessors
           have not been re-generated yet, thus template_XXX is not returned by propertyMap() and
           erp5_YYY/bt/template_XXX.xml is not imported.
           => portal_templates/erp5_YYY new BT does not have template_XXX property set at all.
    d9627917
ERP5Site.py 94.6 KB