diff --git a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py index 509b0e79151a4dd51e0ca6733f43a9c22ce16938..d91c8a5a372d5023cc105c1edce243afc870f130 100644 --- a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py +++ b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py @@ -276,14 +276,15 @@ def Base_savePlot(self, plot=None, reference=None): buff.seek(0) data = buff.getvalue() - # Add new Image object in erp5 with id and reference import time image_id = reference+str(time.time()) - self.newContent( + # Add new Image object in erp5 with id and reference + image_module = self.getDefaultModule(portal_type='Image') + image_module.newContent( portal_type='Image', id=image_id, reference=reference, data=data, filename=filename) - return None \ No newline at end of file + return None diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_savePlot.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_savePlot.xml new file mode 100644 index 0000000000000000000000000000000000000000..3ab04b3b434c98622b191909e9035eaac65ace6a --- /dev/null +++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_savePlot.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Base_savePlot</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>JupyterCompile</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_savePlot</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Base_savePlot</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData>