Commit e5184879 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_dat_notebook bt5: Add External method base_savePlot and use Image module...

erp5_dat_notebook bt5: Add External method base_savePlot and use Image module as context while creating new Image Object in base_savePlot
parent 9eab2df8
...@@ -276,14 +276,15 @@ def Base_savePlot(self, plot=None, reference=None): ...@@ -276,14 +276,15 @@ def Base_savePlot(self, plot=None, reference=None):
buff.seek(0) buff.seek(0)
data = buff.getvalue() data = buff.getvalue()
# Add new Image object in erp5 with id and reference
import time import time
image_id = reference+str(time.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', portal_type='Image',
id=image_id, id=image_id,
reference=reference, reference=reference,
data=data, data=data,
filename=filename) filename=filename)
return None return None
\ No newline at end of file
<?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>
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