From d9479ed486df2c0405a17051ff9b20a0a3905448 Mon Sep 17 00:00:00 2001
From: Ayush Tiwari <ayush.tiwari@nexedi.com>
Date: Sun, 8 Nov 2015 15:41:10 +0100
Subject: [PATCH] erp5_data_notebook bt5: Add 'mime_type' field for Data
 Notebook Line portal_type

---
 .../Base_executeJupyter.xml                   |   2 +-
 .../DataNotebookLine_view.xml                 |   1 +
 .../DataNotebookLine_view/my_mime_type.xml    | 106 ++++++++++++++++++
 .../DataNotebook_addDataNotebookLine.xml      |   3 +-
 4 files changed, 110 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_mime_type.xml

diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
index 811ca01707..5f32e70ae5 100644
--- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
+++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
@@ -169,7 +169,7 @@ except UnicodeDecodeError:\n
   }\n
   serialized_result = json.dumps(result)\n
 \n
-data_notebook_line.edit(notebook_code_result=code_result)\n
+data_notebook_line.edit(notebook_code_result=code_result, mime_type=mime_type)\n
 \n
 return serialized_result\n
 </string> </value>
diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml
index f794205989..28a9f8c5d3 100644
--- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml
+++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml
@@ -74,6 +74,7 @@
                       <list>
                         <string>my_notebook_code</string>
                         <string>my_notebook_code_result</string>
+                        <string>my_mime_type</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_mime_type.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_mime_type.xml
new file mode 100644
index 0000000000..d7d342e443
--- /dev/null
+++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_mime_type.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>display_width</string>
+                <string>editable</string>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_mime_type</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>display_width</string> </key>
+                    <value> <int>20</int> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_string_field</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Mime Type</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml
index 6a38db7bca..2e64fc33c2 100644
--- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml
+++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml
@@ -58,6 +58,7 @@ have notebook_code from jupyter frontend as well as its executed result\n
 notebook_line = context.newContent(\n
     notebook_code=notebook_code,\n
     notebook_code_result=notebook_code_result,\n
+    mime_type=mime_type,\n
     portal_type="Data Notebook Line"\n
   )\n
 \n
@@ -78,7 +79,7 @@ return notebook_line.Base_redirect(\'view\',\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>notebook_code, notebook_code_result=None, batch_mode=False, **kw</string> </value>
+            <value> <string>notebook_code, notebook_code_result=None, mime_type=\'text/plain\', batch_mode=False, **kw</string> </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-- 
2.30.9