'blob_storage' referenced before assignment when using rel-storage in zope2instance recipe

Bug #645100 reported by Mark van Lent
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hanno Schlichting

Bug Description

When using the rel-storage option in the [instance] section, I get an UnboundLocalError raised when running the buildout: local variable 'blob_storage' referenced before assignment. This happens with plone.recipe.zope2instance version 3.6 in line 407 of __init__.py (see attached log).

As far as I can see, the build_zope_conf method checks whether the rel-storage option is used. If not, we'll assign blob_storage to the blob-storage option. Later, outside the if...else clause, blob_storage is accessed (line 407). As a result, the blob_storage variable is never assigned when using the rel_storage option.

Am I doing something wrong here?

Revision history for this message
Mark van Lent (markvl) wrote :
Revision history for this message
Mark van Lent (markvl) wrote :

If my analysis (and usage of the recipe) was correct, A possible solution is to move the assignment of the variables blob_storage and demo_storage outside the if...else loop. Here's a patch for version 3.6 of the recipe.

Revision history for this message
Mark van Lent (markvl) wrote :

And here's the patch for trunk...

Revision history for this message
Mark van Lent (markvl) wrote :

I'm terribly sorry. Once again the problem proved to be the human (me) instead of the code... I still had the zeo-client option set to True.

I think it's a bit tricky that the code triggered by setting the zeo-client option to True, depends on not having the rel-storage option set. This relation could perhaps be made a bit more explicit so the error message is more helpful.

But again, I wasn't paying attention so I should not blame the recipe for it.

Changed in collective.buildout:
assignee: nobody → Hanno Schlichting (hannosch)
status: New → Fix Committed
Changed in collective.buildout:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers