From ace10d25a66d677dd9c84643b8e75c2e63359c49 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayush.tiwari@nexedi.com> Date: Mon, 26 Oct 2015 11:57:30 +0100 Subject: [PATCH] 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 --- .../new_notebook_line.xml} | 6 ++--- .../view.xml | 2 +- .../allowed_content_types.xml | 2 +- .../property_sheet_list.xml | 2 +- ...Message.xml => Data%20Notebook%20Line.xml} | 4 ++-- .../Base_executeJupyter.xml | 8 +++---- ...age_view.xml => DataNotebookLine_view.xml} | 6 ++--- .../my_notebook_code.xml | 0 .../my_notebook_code_result.xml | 0 ...l => DataNotebook_addDataNotebookLine.xml} | 22 ++++++++--------- .../DataNotebook_view/my_listbox.xml | 2 +- .../test.erp5.testExecuteJupyter.py | 24 +++++++++---------- .../bt/template_action_path_list | 4 ++-- ...late_portal_type_allowed_content_type_list | 2 +- .../bt/template_portal_type_id_list | 2 +- .../template_portal_type_property_sheet_list | 2 +- 16 files changed, 44 insertions(+), 44 deletions(-) rename bt5/erp5_data_notebook/ActionTemplateItem/portal_types/{Data%20Notebook%20Message/new_notebook_message.xml => Data%20Notebook%20Line/new_notebook_line.xml} (92%) rename bt5/erp5_data_notebook/ActionTemplateItem/portal_types/{Data%20Notebook%20Message => Data%20Notebook%20Line}/view.xml (96%) rename bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/{Data%20Notebook%20Message.xml => Data%20Notebook%20Line.xml} (88%) rename bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/{DataNotebookMessage_view.xml => DataNotebookLine_view.xml} (94%) rename bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/{DataNotebookMessage_view => DataNotebookLine_view}/my_notebook_code.xml (100%) rename bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/{DataNotebookMessage_view => DataNotebookLine_view}/my_notebook_code_result.xml (100%) rename bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/{DataNotebook_addDataNotebookMessage.xml => DataNotebook_addDataNotebookLine.xml} (81%) diff --git a/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/new_notebook_message.xml b/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/new_notebook_line.xml similarity index 92% rename from bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/new_notebook_message.xml rename to bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/new_notebook_line.xml index c78ffbf111..630ac8e4e7 100644 --- a/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/new_notebook_message.xml +++ b/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/new_notebook_line.xml @@ -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> diff --git a/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/view.xml b/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/view.xml similarity index 96% rename from bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/view.xml rename to bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/view.xml index 1c7f63a5c3..46800e9fea 100644 --- a/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Message/view.xml +++ b/bt5/erp5_data_notebook/ActionTemplateItem/portal_types/Data%20Notebook%20Line/view.xml @@ -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> diff --git a/bt5/erp5_data_notebook/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_data_notebook/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index 637ed6b982..9ac48ae107 100644 --- a/bt5/erp5_data_notebook/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_data_notebook/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -1,6 +1,6 @@ <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> diff --git a/bt5/erp5_data_notebook/PortalTypePropertySheetTemplateItem/property_sheet_list.xml b/bt5/erp5_data_notebook/PortalTypePropertySheetTemplateItem/property_sheet_list.xml index 03dec04ec0..f23c6fa511 100644 --- a/bt5/erp5_data_notebook/PortalTypePropertySheetTemplateItem/property_sheet_list.xml +++ b/bt5/erp5_data_notebook/PortalTypePropertySheetTemplateItem/property_sheet_list.xml @@ -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 diff --git a/bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Message.xml b/bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Line.xml similarity index 88% rename from bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Message.xml rename to bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Line.xml index 7f0a91a98a..b11ed45536 100644 --- a/bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Message.xml +++ b/bt5/erp5_data_notebook/PortalTypeTemplateItem/portal_types/Data%20Notebook%20Line.xml @@ -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> 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 67dc088bad..66d2500092 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 @@ -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 diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml similarity index 94% rename from bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view.xml rename to bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml index 0491b3169e..f794205989 100644 --- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view.xml +++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view.xml @@ -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> diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view/my_notebook_code.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_notebook_code.xml similarity index 100% rename from bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view/my_notebook_code.xml rename to bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_notebook_code.xml diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view/my_notebook_code_result.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_notebook_code_result.xml similarity index 100% rename from bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookMessage_view/my_notebook_code_result.xml rename to bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebookLine_view/my_notebook_code_result.xml diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookMessage.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml similarity index 81% rename from bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookMessage.xml rename to bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml index 68aebdb2af..6a38db7bca 100644 --- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookMessage.xml +++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_addDataNotebookLine.xml @@ -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> diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_view/my_listbox.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_view/my_listbox.xml index c97923919d..4efeb52b77 100644 --- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_view/my_listbox.xml +++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/DataNotebook_view/my_listbox.xml @@ -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> diff --git a/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py b/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py index 5f2e0b8cca..be1442d9c7 100644 --- a/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py +++ b/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py @@ -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): """ diff --git a/bt5/erp5_data_notebook/bt/template_action_path_list b/bt5/erp5_data_notebook/bt/template_action_path_list index fa2672e036..84ae3d5d48 100644 --- a/bt5/erp5_data_notebook/bt/template_action_path_list +++ b/bt5/erp5_data_notebook/bt/template_action_path_list @@ -1,5 +1,5 @@ -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 diff --git a/bt5/erp5_data_notebook/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_data_notebook/bt/template_portal_type_allowed_content_type_list index d33037d62b..8143b7d606 100644 --- a/bt5/erp5_data_notebook/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_data_notebook/bt/template_portal_type_allowed_content_type_list @@ -1,2 +1,2 @@ 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 diff --git a/bt5/erp5_data_notebook/bt/template_portal_type_id_list b/bt5/erp5_data_notebook/bt/template_portal_type_id_list index ac626d26c7..cf43d8fdee 100644 --- a/bt5/erp5_data_notebook/bt/template_portal_type_id_list +++ b/bt5/erp5_data_notebook/bt/template_portal_type_id_list @@ -1,3 +1,3 @@ Data Notebook -Data Notebook Message +Data Notebook Line Data Notebook Module \ No newline at end of file diff --git a/bt5/erp5_data_notebook/bt/template_portal_type_property_sheet_list b/bt5/erp5_data_notebook/bt/template_portal_type_property_sheet_list index 4df36522eb..6678153798 100644 --- a/bt5/erp5_data_notebook/bt/template_portal_type_property_sheet_list +++ b/bt5/erp5_data_notebook/bt/template_portal_type_property_sheet_list @@ -1,3 +1,3 @@ -Data Notebook Message | XMLObject +Data Notebook Line | XMLObject Data Notebook | Jupyter Notebook Data Notebook | Reference \ No newline at end of file -- 2.30.9