Commit b50bd329 authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Douglas

erp5_data_notebook bt5: Changed name of portal type from Data Notebook Message...

erp5_data_notebook bt5: Changed name of portal type from Data Notebook Message to Data Notebook Line and changes in various scripts where it has been used
parent bb444a69
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>new_notebook_message</string> </value>
<value> <string>new_notebook_line</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>New Notebook Message</string> </value>
<value> <string>New Notebook Line</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DataNotebookModule_viewAddNotebookMessageDialog</string> </value>
<value> <string>string:${object_url}/DataNotebookModule_viewAddNotebookLineDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DataNotebookMessage_view</string> </value>
<value> <string>string:${object_url}/DataNotebookLine_view</string> </value>
</item>
</dictionary>
</pickle>
......
<allowed_content_type_list>
<portal_type id="Data Notebook">
<item>Data Notebook Message</item>
<item>Data Notebook Line</item>
</portal_type>
<portal_type id="Data Notebook Module">
<item>Data Notebook</item>
......
......@@ -3,7 +3,7 @@
<item>Jupyter Notebook</item>
<item>Reference</item>
</portal_type>
<portal_type id="Data Notebook Message">
<portal_type id="Data Notebook Line">
<item>XMLObject</item>
</portal_type>
</property_sheet_list>
\ No newline at end of file
......@@ -14,11 +14,11 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Contains code message and the value returned .</string> </value>
<value> <string>Contains code and the value returned by single line from Jupyter Notebook.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Data Notebook Message</string> </value>
<value> <string>Data Notebook Line</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
......
......@@ -68,7 +68,7 @@ identifying notebook by reference from user.\n
Expected behaviour from this script:-\n
1. Return unauthorized message for non-developer user.\n
2. Create new \'Data Notebook\' for new reference.\n
3. Add new \'Data Notebook Message\'to the existing Data Notebook on basis of reference.\n
3. Add new \'Data Notebook Line\'to the existing Data Notebook on basis of reference.\n
4. Return python dictionary containing list of all notebooks for \'request_reference=True\'\n
"""\n
\n
......@@ -110,8 +110,8 @@ if not data_notebook:\n
batch_mode=True\n
)\n
\n
# Add new Data Notebook Message to the Data Notebook\n
data_notebook_message = data_notebook.DataNotebook_addDataNotebookMessage(\n
# Add new Data Notebook Line to the Data Notebook\n
data_notebook_line = data_notebook.DataNotebook_addDataNotebookLine(\n
notebook_code=python_expression,\n
batch_mode=True\n
)\n
......@@ -154,7 +154,7 @@ result = {\n
# Catch exception while seriaizing the result to be passed to jupyter frontend\n
try:\n
serialized_result = json.dumps(result)\n
data_notebook_message.edit(notebook_code_result=code_result)\n
data_notebook_line.edit(notebook_code_result=code_result)\n
except UnicodeDecodeError:\n
result = {\n
u\'code_result\': None,\n
......
......@@ -88,7 +88,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DataNotebookMessage_view</string> </value>
<value> <string>DataNotebookLine_view</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -96,7 +96,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>DataNotebookMessage_view</string> </value>
<value> <string>DataNotebookLine_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -112,7 +112,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Data Notebook Message</string> </value>
<value> <string>Data Notebook Line</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -51,28 +51,28 @@
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
This python script concerns with creation of new notebook message which would\n
This python script concerns with creation of new notebook line which would\n
have notebook_code from jupyter frontend as well as its executed result\n
"""\n
# Create new Data Notebook Message object\n
notebook_message = context.newContent(\n
# Create new Data Notebook Line object\n
notebook_line = context.newContent(\n
notebook_code=notebook_code,\n
notebook_code_result=notebook_code_result,\n
portal_type="Data Notebook Message"\n
portal_type="Data Notebook Line"\n
)\n
\n
# Return notebook_message object for batch mode, used in tests\n
# Return notebook_line object for batch mode, used in tests\n
if batch_mode:\n
return notebook_message\n
return notebook_line\n
\n
# Add status message to be displayed after new notebook message creation\n
# Add status message to be displayed after new notebook line creation\n
translateString = context.Base_translateString\n
portal_status_message = translateString(\n
"New Notebook message created"\n
"New Notebook line created"\n
)\n
\n
# Redirect the notebook_message view with the status message being displayed\n
return notebook_message.Base_redirect(\'view\',\n
# Redirect the notebook_line view with the status message being displayed\n
return notebook_line.Base_redirect(\'view\',\n
keep_items=dict(portal_status_message=portal_status_message), **kw)\n
</string> </value>
</item>
......@@ -82,7 +82,7 @@ return notebook_message.Base_redirect(\'view\',\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DataNotebook_addDataNotebookMessage</string> </value>
<value> <string>DataNotebook_addDataNotebookLine</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -580,7 +580,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Notebook Message</string> </value>
<value> <string>Notebook Line</string> </value>
</item>
<item>
<key> <string>untranslatable_columns</string> </key>
......
......@@ -61,11 +61,11 @@ class TestExecuteJupyter(SecurityTestCase):
batch_mode=True
)
def _newNotebookMessage(self, notebook_module=None, notebook_code=None):
def _newNotebookLine(self, notebook_module=None, notebook_code=None):
"""
Function to create new notebook messgae
Function to create new notebook line
"""
return notebook_module.DataNotebook_addDataNotebookMessage(
return notebook_module.DataNotebook_addDataNotebookLine(
notebook_code=notebook_code,
batch_mode=True
)
......@@ -150,7 +150,7 @@ portal.%s()
def testUserCanCreateNotebookWithCode(self):
"""
Test if user can create Data Notebook Message object or not
Test if user can create Data Notebook Line object or not
"""
portal = self.portal
......@@ -158,18 +158,18 @@ portal.%s()
self.tic()
notebook_code='some_random_invalid_notebook_code %s' % time.time()
self._newNotebookMessage(
self._newNotebookLine(
notebook_module=notebook,
notebook_code=notebook_code
)
self.tic()
notebook_message_search_result = portal.portal_catalog(
notebook_line_search_result = portal.portal_catalog(
portal_type='Data Notebook',
notebook_code=notebook_code
)
result = [obj.getId() for obj in notebook_message_search_result]
result = [obj.getId() for obj in notebook_line_search_result]
if result:
self.assertIn(notebook.getId(), result)
......@@ -196,15 +196,15 @@ portal.%s()
self.assertEquals(len([obj.getTitle() for obj in notebook_list]), 1)
def testBaseExecuteJupyterAddNotebookMessage(self):
def testBaseExecuteJupyterAddNotebookLine(self):
"""
Test if the notebook adds code history to the Data Notebook Message
Test if the notebook adds code history to the Data Notebook Line
portal type
"""
portal = self.portal
self.login('dev_user')
python_expression = "print 52"
reference = 'Test.Notebook.AddNewNotebookMessage %s' % time.time()
reference = 'Test.Notebook.AddNewNotebookLine %s' % time.time()
title = 'Test NB Title %s' % time.time()
# Calling the function twice, first to create a new notebook and then
......@@ -223,12 +223,12 @@ portal.%s()
reference=reference
)
notebook_message_search_result = portal.portal_catalog.getResultValue(
notebook_line_search_result = portal.portal_catalog.getResultValue(
portal_type='Data Notebook',
reference=reference,
notebook_code=python_expression
)
self.assertEquals(notebook.getId(), notebook_message_search_result.getId())
self.assertEquals(notebook.getId(), notebook_line_search_result.getId())
def testBaseExecuteJupyterErrorHandling(self):
"""
......
Data Notebook Message | new_notebook_message
Data Notebook Message | view
Data Notebook Line | new_notebook_line
Data Notebook Line | view
Data Notebook Module | view
Data Notebook | new_notebook
Data Notebook | view
\ No newline at end of file
Data Notebook Module | Data Notebook
Data Notebook | Data Notebook Message
\ No newline at end of file
Data Notebook | Data Notebook Line
\ No newline at end of file
Data Notebook
Data Notebook Message
Data Notebook Line
Data Notebook Module
\ No newline at end of file
Data Notebook Message | XMLObject
Data Notebook Line | XMLObject
Data Notebook | Jupyter Notebook
Data Notebook | Reference
\ No newline at end of file
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