Commit 93ee9ba1 authored by Jérome Perrin's avatar Jérome Perrin

Adjust full_write_guard patch for Zope4 🚧

parent c5ce7ff8
Pipeline #26100 failed with stage
in 0 seconds
...@@ -64,17 +64,15 @@ allow_type(type(np.c_)) ...@@ -64,17 +64,15 @@ allow_type(type(np.c_))
import sklearn.linear_model import sklearn.linear_model
allow_class(sklearn.linear_model.LinearRegression) allow_class(sklearn.linear_model.LinearRegression)
# Modify 'safetype' dict in full_write_guard function # allow write access to ndarray, DataFrame, ZBigArray and RAMArray objects
# of RestrictedPython (closure) directly To allow from Products.ERP5Type.patches.Restricted import allow_full_write # TODO(zope4py2): we need a better place to import this (why not in RestrictedPython ?)
# write access to ndarray, DataFrame, ZBigArray and RAMArray objects allow_full_write(np.ndarray)
from RestrictedPython.Guards import full_write_guard allow_full_write(np.core.records.recarray)
full_write_guard.func_closure[1].cell_contents.__self__[np.ndarray] = True allow_full_write(np.core.records.record)
full_write_guard.func_closure[1].cell_contents.__self__[np.core.records.recarray] = True
full_write_guard.func_closure[1].cell_contents.__self__[np.core.records.record] = True
from wendelin.bigarray.array_zodb import ZBigArray from wendelin.bigarray.array_zodb import ZBigArray
full_write_guard.func_closure[1].cell_contents.__self__[ZBigArray] = True allow_full_write(ZBigArray)
allow_type(ZBigArray) allow_type(ZBigArray)
from wendelin.bigarray.array_ram import RAMArray from wendelin.bigarray.array_ram import RAMArray
full_write_guard.func_closure[1].cell_contents.__self__[RAMArray] = True allow_full_write(RAMArray)
allow_type(RAMArray) allow_type(RAMArray)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment