title: Plone 4.1.3 migration fails
body: <p>Ive upgraded using buildout from 4.0.5 to 4.1.3, but when I try to upgrade (first time login) I get this:</p>
  
  <pre><code>... ERROR plone.app.upgrade Upgrade aborted. Error:
  
  Traceback (most recent call last):
    File "/usr/local/Plone/buildout-cache/eggs/Products.CMFPlone-4.1.3-py2.6.egg/Products/CMFPlone/MigrationTool.py", line 175, in upgrade
      step['step'].doStep(setup)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/upgrade.py", line 140, in doStep
      self.handler(tool)
    File "/usr/local/Plone/buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v41/alphas.py", line 105, in add_siteadmin_role
      for permission_id, roles in state.permission_roles.items():
  AttributeError: 'NoneType' object has no attribute 'items'
  
  ...ERROR plone.app.upgrade Migration has failed
  </code></pre>
  
  <p>Upgrading steps:</p>
  
  <pre><code>Current
      4018
  Latest
      4112
  (4018 → 4019)
  * No upgrade steps
  (4019 → 4020)
  * No upgrade steps
  (4020 → 4022)
  * No upgrade steps
  (4022 → 4100)
  * Add Site Administrator role
  * Update role mappings
  * Update control panel permissions
  * Install plone.outputfilters
  * Miscellaneous
  (4100 → 4101)
  * Miscellaneous
  (4101 → 4102)
  * Miscellaneous
  (4102 → 4103)
  * Miscellaneous
  (4103 → 4104)
  * Miscellaneous
  (4104 → 4105)
  * Miscellaneous
  (4105 → 4106)
  * Miscellaneous
  (4106 → 4107)
  * Miscellaneous
  (4107 → 4108)
  * Miscellaneous
  (4108 → 4109)
  * Miscellaneous
  (4109 → 4110)
  * Fix OkapiIndex total document lengths
  (4110 → 4111)
  * Repair owner tuples
  * Miscellaneous
  (4111 → 4112)
  * Miscellaneous
  </code></pre>
  
  <p>Vangheem:
  I tried the second solution by adding </p>
  
  <pre><code>         if state.permission_roles is None:
               continue
  </code></pre>
  
  <p>to</p>
  
  <p>../buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v41/alphas.py</p>
  
  <p>I do not know if its a problem but there are several alphas.py:</p>
  
  <p>[root@www /usr/local/Plone]# find . -type f -name 'alphas.py'
  ./buildout-cache/eggs/plone.app.upgrade-1.0.5-py2.6.egg/plone/app/upgrade/v30/alphas.py
  ./buildout-cache/eggs/plone.app.upgrade-1.0.5-py2.6.egg/plone/app/upgrade/v40/alphas.py
  ./buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v30/alphas.py
  ./buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v40/alphas.py
  ./buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v41/alphas.py</p>
  
  <p>Anyway, I then did the migration and it got a lot better -  I got this new error below though:</p>
  
  <p>Role / permission map imported.
  Step collective.blogging.reset-layers has an invalid import handler
  Class Products.PloneboardSubscription.NotificationTool.NotificationTool not found for tool portal_pbnotification
  Upgrade aborted. Error:
  Traceback (most recent call last):
    File "/usr/local/Plone/buildout-cache/eggs/Products.CMFPlone-4.1.3-py2.6.egg/Products/CMFPlone/MigrationTool.py", line 175, in upgrade
      step['step'].doStep(setup)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/upgrade.py", line 140, in doStep
      self.handler(tool)
    File "/usr/local/Plone/buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/v41/betas.py", line 112, in to41beta2
      loadMigrationProfile(context, 'profile-plone.app.upgrade.v41:to41beta2')
    File "/usr/local/Plone/buildout-cache/eggs/plone.app.upgrade-1.1.4-py2.6.egg/plone/app/upgrade/utils.py", line 112, in loadMigrationProfile
      context.runAllImportStepsFromProfile(profile, purge_old=False)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/tool.py", line 323, in runAllImportStepsFromProfile
      ignore_dependencies=ignore_dependencies)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/tool.py", line 1084, in _runImportStepsFromContext
      message = self._doRunImportStep(step, context)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/tool.py", line 998, in _doRunImportStep
      return handler(context)
    File "/usr/local/Plone/buildout-cache/eggs/Products.GenericSetup-1.6.4-py2.6.egg/Products/GenericSetup/tool.py", line 123, in importToolset
      new_tool = tool_class(tool_id)
  TypeError: 'NoneType' object is not callable
  End of upgrade path, migration has finished
  The upgrade path did NOT reach current version
  Migration has failed
  END</p>
  
  <p>NB before the upgrade I removed Products.PloneboardSubscription from add-on and made an uninstall. Also I removed collective.blogging long time ago. Somehow there are still some references to it when trying to migrate:</p>
  
  <p>There are unresolved or circular dependencies. Graphviz diagram:: digraph dependencies {"typeinfo" -> "toolset"; "tinymce_settings" -> "componentregistry"; "kss_mimetype" -> "mimetypes-registry-various"; "collective.blogging.reset-roles";"atcttool" -> "catalog"; "atcttool" -> "componentregistry"; "actions" -> "componentregistry"; "skins" -> "componentregistry"; "languagetool" -> "toolset"; "factorytool" -> "componentregistry"; "factorytool" -> "typeinfo"; "ploneboard-various" -> "toolset"; "ploneboard-various" -> "typeinfo"; "ploneboard-various" -> "placeful_workflow"; "placeful_workflow" -> "typeinfo"; "placeful_workflow" -> "workflow"; "portal-transforms-various" -> "componentregistry"; "componentregistry" -> "toolset"; "plone.app.caching";"controlpanel" -> "actions"; "controlpanel" -> "componentregistry"; "placeful_marker" -> "workflow"; "jsregistry" -> "toolset"; "jsregistry" -> "componentregistry"; "action-icons" -> "componentregistry"; "plone.app.registry" -> "componentregistry"; "plone.app.registry" -> "toolset"; "mimetypes-registry-various" -> "componentregistry"; "reference_catalog" -> "toolset"; "viewlets" -> "componentregistry"; "content" -> "typeinfo"; "collective.blogging.reset-catalog";"propertiestool" -> "componentregistry"; "various" -> "toolset"; "collective.blogging.reset-views";"portlets" -> "componentregistry"; "portlets" -> "content"; "content_type_registry" -> "componentregistry"; "plone-final" -> "kss_mimetype"; "plone-final" -> "portlets"; "plone-final" -> "rolemap"; "kssregistry" -> "toolset"; "kssregistry" -> "componentregistry"; "poi_various" -> "catalog"; "ploneopenid-various";"update-workflow-rolemap" -> "workflow"; "sharing" -> "rolemap"; "uid_catalog" -> "toolset"; "workflow" -> "toolset"; "collective.plonetruegallery.install";"cssregistry" -> "toolset"; "cssregistry" -> "componentregistry"; "contentrules" -> "componentregistry"; "contentrules" -> "content"; "catalog" -> "toolset"; "simpleattachment" -> "properties"; "simpleattachment" -> "typeinfo"; "cookie_authentication" -> "toolset"; "cmfeditions_various" -> "toolset"; "cmfeditions_various" -> "typeinfo"; "difftool" -> "toolset"; "difftool" -> "componentregistry"; "plone-content" -> "plone-final"; "toolset";"properties";"collective.blogging.reset-layers";"plonepas" -> "componentregistry"; "plonepas" -> "controlpanel"; "plonepas" -> "memberdata-properties"; "plonepas" -> "plonepas-contents"; "plonepas" -> "rolemap"; "jquerytools-various" -> "cssregistry"; "tinymce_various" -> "componentregistry"; "browserlayer" -> "componentregistry"; "plone-difftool";"plone_outputfilters_various" -> "componentregistry"; "memberdata-properties" -> "componentregistry"; "Products.EasyNewsletter-setuphandlers";"plonetheme.sunburst-various" -> "actions"; "caching_policy_mgr" -> "toolset"; "archetypetool" -> "archetypes-various"; "mailhost" -> "componentregistry"; "repositorytool" -> "toolset"; "repositorytool" -> "typeinfo"; "repositorytool" -> "cmfeditions_various"; "Products.Ploneboard.uninstallVarious";"various-calendar" -> "toolset"; "collective.flowplayer" -> "kupu-setup"; "collective.flowplayer" -> "propertiestool"; "kupu-setup" -> "toolset"; "kupu-setup" -> "typeinfo"; "archetypes-various" -> "componentregistry"; "rolemap";"plonepas" [color=red,style=filled]; }</p>
  
  <p>Thanks.
  Nikolaj G.</p>