4teamwork / ftw.upgrade

An upgrade control panel and upgrade helpers for plone upgrades.
6 stars 10 forks source link

Error when the upgrade list contains... a list #207

Closed ale-rt closed 4 years ago

ale-rt commented 4 years ago

I tried to add ftw.upgrade to a quite old package but the instance does not start anymore :/

  File "/home/ale/.buildout/eggs/ftw.upgrade-3.0.1-py3.8.egg/ftw/upgrade/directory/zcml.py", line 115, in find_start_version
    upgrades.sort(key=attrgetter('dest'))
    AttributeError: 'list' object has no attribute 'dest'

The reason is that some upgrade steps are registered using the upgradeSteps directive, see: https://docs.plone.org/develop/addons/components/genericsetup.html#combining-upgrade-steps, so sometime the element of the upgrades list are UpgradeStep instances and some times are lists (containing more than one upgrade step).

(Pdb) pp upgrades[0]
[('1345086614084183203',
  <Products.GenericSetup.upgrade.UpgradeStep object at 0x7f140a486910>)]
(Pdb) pp upgrades[1]
<Products.GenericSetup.upgrade.UpgradeStep object at 0x7f140a486950>
ale-rt commented 4 years ago

I think I submit a patch, stay tuned!