erp5 kernel: improved detection of variables from user context that cannot be put in the zodb
Variables are investigated, recursively in case of container objects (like lists, for example), to detect if they can be stored in the ZODB. In this investigation persistent objects are identified by being an instance of the object class and implementing a `__getstate__` method that raises no exception. If the variable is not a Persistent object then we try to pickle and load it. While developing the pickleable object identification a complication was found. It seems that the code cannot capture cPickle.PicklingError in the usual way, `except cPickle.PicklingError`. It's consequence of some weirdness with regards to pickle/cPickle modules exceptions classes and more about it can be read at http://bugs.python.org/issue1457119. So, the workaround for this complication was to catch all exceptions and check the exception class name as string. The whole check for zodb persistence was moved into an utility function for the sake of readability and code maintenance. The Base_executeJupyter script object was transformed into an extension to be able to properly handle transaction errors and render them correctly inside Jupyter.
Showing
This diff is collapsed.
Please register or sign in to comment