Commit 0f361067 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_data_notebook bt5: Add comments in python scripts from portal_skin for this bt5

parent bb3fe819
...@@ -50,17 +50,28 @@ ...@@ -50,17 +50,28 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n <value> <string>"""\n
Python script to add a new notebook to Data Notebook module.\n
This script also concerns for assigning an Active Process for each data notebook\n
created.\n
"""\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n \n
# Comment out person in case addition of person required to Data Notebook object\n
#person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n #person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n \n
# Create new ActiveProcess object and getting its id\n
active_process = context.portal_activities.newActiveProcess()\n active_process = context.portal_activities.newActiveProcess()\n
active_process_id = active_process.getId()\n active_process_id = active_process.getId()\n
\n \n
# Creating new dictionary via external method to save results in ZODB\n
new_dict = context.Base_addPersistentMapping()\n new_dict = context.Base_addPersistentMapping()\n
# Add new ActiveResult object and add it to the activeprocess concerned with ...\n
# Data Notebook in concern\n
result = ActiveResult(summary=new_dict)\n result = ActiveResult(summary=new_dict)\n
active_process.activateResult(result)\n active_process.activateResult(result)\n
\n \n
# Create new notebook\n
notebook = context.newContent(\n notebook = context.newContent(\n
title=title,\n title=title,\n
reference=reference,\n reference=reference,\n
...@@ -68,14 +79,17 @@ notebook = context.newContent(\n ...@@ -68,14 +79,17 @@ notebook = context.newContent(\n
portal_type=\'Data Notebook\'\n portal_type=\'Data Notebook\'\n
)\n )\n
\n \n
# Return notebook for batch_mode, used in tests\n
if batch_mode:\n if batch_mode:\n
return notebook\n return notebook\n
\n \n
# Add status message to be displayed after new notebook creation\n
translateString = context.Base_translateString\n translateString = context.Base_translateString\n
portal_status_message = translateString(\n portal_status_message = translateString(\n
"New Notebook created"\n "New Notebook created"\n
)\n )\n
\n \n
# Redirect the notebook view with the status message being displayed\n
return notebook.Base_redirect(\'view\',\n return notebook.Base_redirect(\'view\',\n
keep_items=dict(portal_status_message=portal_status_message), **kw)\n keep_items=dict(portal_status_message=portal_status_message), **kw)\n
</string> </value> </string> </value>
......
...@@ -50,20 +50,28 @@ ...@@ -50,20 +50,28 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>notebook_message = context.newContent(\n <value> <string>"""\n
This python script concerns with creation of new notebook message 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
notebook_code=notebook_code,\n notebook_code=notebook_code,\n
notebook_code_result=notebook_code_result,\n notebook_code_result=notebook_code_result,\n
portal_type="Data Notebook Message"\n portal_type="Data Notebook Message"\n
)\n )\n
\n \n
# Return notebook_message object for batch mode, used in tests\n
if batch_mode:\n if batch_mode:\n
return notebook_message\n return notebook_message\n
\n \n
# Add status message to be displayed after new notebook message creation\n
translateString = context.Base_translateString\n translateString = context.Base_translateString\n
portal_status_message = translateString(\n portal_status_message = translateString(\n
"New Notebook message created"\n "New Notebook message created"\n
)\n )\n
\n \n
# Redirect the notebook_message view with the status message being displayed\n
return notebook_message.Base_redirect(\'view\',\n return notebook_message.Base_redirect(\'view\',\n
keep_items=dict(portal_status_message=portal_status_message), **kw)\n keep_items=dict(portal_status_message=portal_status_message), **kw)\n
</string> </value> </string> </value>
......
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