Missing Attribute in Sample Workflow after 2.5.0 > 2.6.0 update (w/ senaite.storage)

Hello,
I just wanted to share resolution of an error I had after the latest upgrade.

When using the “Samples” workflow/ page, whenever I would check the box next to a sample in the “received” state, I would get an internal server (500) error.

(root)/samples/view/transitions
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 176, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 385, in publish_module
  Module ZPublisher.WSGIPublisher, line 288, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module senaite.app.listing.view, line 246, in __call__
  Module senaite.app.listing.ajax, line 113, in handle_subpath
  Module senaite.core.decorators, line 40, in decorator
  Module senaite.app.listing.decorators, line 63, in wrapper
  Module senaite.app.listing.decorators, line 50, in wrapper
  Module senaite.app.listing.decorators, line 100, in wrapper
  Module senaite.app.listing.ajax, line 446, in ajax_transitions
  Module senaite.app.listing.ajax, line 201, in get_allowed_transitions_for
  Module senaite.app.listing.adapters.transitions, line 108, in get_transitions
  Module senaite.app.listing.adapters.transitions, line 152, in get_workflow_transitions
  Module bika.lims.api, line 1233, in get_transitions_for
  Module Products.CMFPlone.WorkflowTool, line 107, in getTransitionsFor
  Module Products.DCWorkflow.DCWorkflow, line 395, in _checkTransitionGuard
  Module Products.DCWorkflow.Guard, line 93, in check
  Module Products.CMFCore.Expression, line 53, in __call__
  Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
   - __traceback_info__: here.guard_store_sample()
  Module PythonExpr, line 1, in <module>
AttributeError: 'RequestContainer' object has no attribute 'guard_store_sample' 

I was able to correct the issue on the configuration interface by going to the site management interface ((site root)/portal_workflow/senaite_sample_workflow/transitions/store/manage_properties )

… And changing the expression field from
python:here.guard_store_sample()
to
python: hasattr(here, 'guard_store_sample') and here.guard_store_sample()

I was not able to replicate the error on a clean install of 2.6.0 so it may simply be an artifact of my previous install, but I do think it is somehow related to the update process/ scripting.

Happy updating.

1 Like