Commit 1b31fcbd authored by Jérome Perrin's avatar Jérome Perrin

Improve Developer experience (mostly ERP5 Workflow/Python Scripts)

Fixes [#20210517-960A47](https://erp5js.nexedi.net/#/bug_module/20210517-960A47)

The most important changes are:
 - coding style is enabled again for workflow scripts and starts to be enabled for ERP5 Python scripts
 - monaco editor support for workflow scripts, SQL methods and .less
 - small fixes for python/workflow scripts forms and ZMI

See merge request nexedi/erp5!1422
parents 015bc1c1 b1f36ffd
Pipeline #15655 failed with stage
in 0 seconds
...@@ -10,41 +10,41 @@ The test operates on 'today' transactions. ...@@ -10,41 +10,41 @@ The test operates on 'today' transactions.
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
accounting_module = portal.accounting_module
account_module = portal.account_module account_module = portal.account_module
ledger = portal.portal_categories.ledger ledger = portal.portal_categories.ledger
organisation_module = portal.organisation_module organisation_module = portal.organisation_module
person_module = portal.person_module
one_hour = 1.0 / 24.0 one_hour = 1.0 / 24.0
now = DateTime() now = DateTime()
today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour
if with_ledger: if with_ledger:
extra_kwargs_general = {'ledger': 'accounting/general'} extra_kwargs_general = {'ledger': 'accounting/general'}
extra_kwargs_detailed = {'ledger': 'accounting/detailed'} extra_kwargs_detailed = {'ledger': 'accounting/detailed'}
accounting_ledger = ledger.get('accounting', None) accounting_ledger = ledger.get('accounting', None)
if accounting_ledger is None: if accounting_ledger is None:
accounting_ledger = ledger.newContent(portal_type='Category', id='accounting') accounting_ledger = ledger.newContent(portal_type='Category',
id='accounting')
for sub_category_name in ('general', 'detailed'): for sub_category_name in ('general', 'detailed'):
sub_category = accounting_ledger.get(sub_category_name, None) sub_category = accounting_ledger.get(sub_category_name, None)
if sub_category is None: if sub_category is None:
sub_category = accounting_ledger.newContent(portal_type='Category', id=sub_category_name) sub_category = accounting_ledger.newContent(portal_type='Category',
id=sub_category_name)
# necessary for the "ledger" form field to appear and have correct options # necessary for the "ledger" form field to appear and have correct options
accounting_transaction = portal.portal_types.get('Accounting Transaction') accounting_transaction = portal.portal_types.get('Accounting Transaction')
ledger_list = accounting_transaction.getLedgerList() ledger_list = accounting_transaction.getLedgerList()
if 'accounting/general' not in ledger_list: if 'accounting/general' not in ledger_list:
ledger_list.append('accounting/general') ledger_list.append('accounting/general')
if 'accounting/detailed' not in ledger_list: if 'accounting/detailed' not in ledger_list:
ledger_list.append('accounting/detailed') ledger_list.append('accounting/detailed')
accounting_transaction.setLedgerList(ledger_list) accounting_transaction.setLedgerList(ledger_list)
else: else:
extra_kwargs_general = {} extra_kwargs_general = {}
extra_kwargs_detailed = {} extra_kwargs_detailed = {}
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
...@@ -54,13 +54,12 @@ context.AccountingTransactionModule_createAccountingTestDocument( ...@@ -54,13 +54,12 @@ context.AccountingTransactionModule_createAccountingTestDocument(
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 1 * one_hour, start_date=today + 1 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable, source_value=account_module.receivable,
source_debit=100.0), source_debit=100.0),
dict(portal_type='Accounting Transaction Line', dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales, source_value=account_module.goods_sales,
source_credit=100.0)), source_credit=100.0)),
**extra_kwargs_general **extra_kwargs_general)
)
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
...@@ -70,25 +69,25 @@ context.AccountingTransactionModule_createAccountingTestDocument( ...@@ -70,25 +69,25 @@ context.AccountingTransactionModule_createAccountingTestDocument(
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 2 * one_hour, start_date=today + 2 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=200.0), source_value=account_module.payable,
source_debit=200.0),
dict(portal_type='Accounting Transaction Line', dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales, source_value=account_module.goods_sales,
source_credit=200.0)), source_credit=200.0)),
**extra_kwargs_general **extra_kwargs_general)
)
if with_ledger: if with_ledger:
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 3', title='Transaction 3',
source_reference='3', source_reference='3',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 3 * one_hour, start_date=today + 3 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=400.0), source_value=account_module.payable,
dict(portal_type='Accounting Transaction Line', source_debit=400.0),
source_value=account_module.goods_sales, dict(portal_type='Accounting Transaction Line',
source_credit=400.0)), source_value=account_module.goods_sales,
**extra_kwargs_detailed source_credit=400.0)),
) **extra_kwargs_detailed)
...@@ -94,8 +94,11 @@ ...@@ -94,8 +94,11 @@
model_language = 'javascript'; model_language = 'javascript';
} else if (options.portal_type === 'Web Style') { } else if (options.portal_type === 'Web Style') {
model_language = 'css'; model_language = 'css';
} else if (options.portal_type === 'SQL Method') {
model_language = 'sql';
} else if ( } else if (
options.portal_type === 'Python Script' || options.portal_type === 'Python Script' ||
options.portal_type === 'Workflow Script' ||
options.portal_type === 'Test Component' || options.portal_type === 'Test Component' ||
options.portal_type === 'Extension Component' || options.portal_type === 'Extension Component' ||
options.portal_type === 'Document Component' || options.portal_type === 'Document Component' ||
......
...@@ -77,9 +77,10 @@ class PythonScript(XMLObject, ZopePythonScript, ExpressionMixin('expression')): ...@@ -77,9 +77,10 @@ class PythonScript(XMLObject, ZopePythonScript, ExpressionMixin('expression')):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
#View content list, Force /view, Standart option in python scripts #View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0], manage_options = ( ZopePythonScript.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \ {'icon':'', 'label':'View','action':'view'}) \
+ ZopePythonScript.manage_options + ( XMLObject.manage_options[0], ) \
+ ZopePythonScript.manage_options[1:]
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
......
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
</item> </item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <value> <string>/misc_/PythonScripts/pyscript.gif</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -65,6 +63,18 @@ ...@@ -65,6 +63,18 @@
<key> <string>type_class</string> </key> <key> <string>type_class</string> </key>
<value> <string>PythonScript</string> </value> <value> <string>PythonScript</string> </value>
</item> </item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <value> <string>/misc_/PythonScripts/pyscript.gif</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -61,7 +61,7 @@ def checkPythonScript(script_instance, script_path): ...@@ -61,7 +61,7 @@ def checkPythonScript(script_instance, script_path):
Message( Message(
location="{script_path}:{row}:{column}".format(**annotation), location="{script_path}:{row}:{column}".format(**annotation),
message=annotation['text'], message=annotation['text'],
edit_url="{script_path}/manage_main?line={row}".format(**annotation),)) edit_url="{script_path}/manage_workspace?line={row}".format(**annotation),))
def checkComponent(component_instance): def checkComponent(component_instance):
"""Check a component, adding messages to global `line_list` """Check a component, adding messages to global `line_list`
...@@ -93,9 +93,11 @@ for workflow_id in context.getTemplateWorkflowIdList(): ...@@ -93,9 +93,11 @@ for workflow_id in context.getTemplateWorkflowIdList():
for script_container in script_container_list: for script_container in script_container_list:
for script_path, script_instance in portal.ZopeFind( for script_path, script_instance in portal.ZopeFind(
script_container, script_container, obj_metatypes=[
obj_metatypes=['Script (Python)'], 'Script (Python)',
search_sub=1): 'ERP5 Python Script',
'ERP5 Workflow Script',
], search_sub=1):
checkPythonScript(script_instance, "%s/%s" % ( checkPythonScript(script_instance, "%s/%s" % (
portal.portal_url.getRelativeUrl(script_container), script_path)) portal.portal_url.getRelativeUrl(script_container), script_path))
......
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
<list> <list>
<string>my_parameter_signature</string> <string>my_parameter_signature</string>
<string>my_description</string> <string>my_description</string>
<string>error_message</string> <string>your_error_message</string>
<string>warning_message</string> <string>your_warning_message</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>error_message</string> </value> <value> <string>your_error_message</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>warning_message</string> </value> <value> <string>your_warning_message</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -62,10 +62,6 @@ ...@@ -62,10 +62,6 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <value>
...@@ -107,7 +103,7 @@ ...@@ -107,7 +103,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
......
...@@ -63,10 +63,28 @@ ...@@ -63,10 +63,28 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -85,24 +103,7 @@ ...@@ -85,24 +103,7 @@
<item> <item>
<key> <string>items</string> </key> <key> <string>items</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>Manager</string>
<string>Manager</string>
</tuple>
<tuple>
<string>Author</string>
<string>Author</string>
</tuple>
<tuple>
<string>Assignor</string>
<string>Assignor</string>
</tuple>
<tuple>
<string>Assignee</string>
<string>Assignee</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -131,4 +132,17 @@ ...@@ -131,4 +132,17 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(role, role) for role in context.valid_roles()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -2,10 +2,20 @@ ...@@ -2,10 +2,20 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="EditorField" module="Products.ERP5Form.EditorField"/> <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>renderjs_extra</string>
<string>title</string>
</list>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_src</string> </value> <value> <string>my_src</string> </value>
...@@ -18,22 +28,6 @@ ...@@ -18,22 +28,6 @@
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -42,79 +36,11 @@ ...@@ -42,79 +36,11 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>alternate_name</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -124,82 +50,28 @@ ...@@ -124,82 +50,28 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>renderjs_extra</string> </key>
<value> <string></string> </value> <value>
</item> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<item> </value>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -207,86 +79,45 @@ ...@@ -207,86 +79,45 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>field_id</string> </key>
<value> <int>1</int> </value> <value> <string>my_view_mode_text_content</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>max_lines</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string>Base_viewFieldLibrary</string> </value>
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>renderjs_extra</string> </key>
<value> <int>0</int> </value> <value>
</item> <list/>
<item> </value>
<key> <string>text_editor</string> </key>
<value> <string>codemirror</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Template</string> </value> <value> <string>Template</string> </value>
</item> </item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>120</int> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'editor\', context.getPortalObject().portal_preferences.getPreferredSourceCodeEditor(\'text_area\')), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\'))]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -3,6 +3,6 @@ if len(old_line_list) == 4 and len(new_line_list) == 1 and \ ...@@ -3,6 +3,6 @@ if len(old_line_list) == 4 and len(new_line_list) == 1 and \
old_line_list[2] == '<tuple/>' and \ old_line_list[2] == '<tuple/>' and \
old_line_list[3] =='</tuple>' and \ old_line_list[3] =='</tuple>' and \
old_line_list[1]== new_line_list[0]: old_line_list[1]== new_line_list[0]:
return True return True
return False return False
if len(old_line_list) == 1 and len(new_line_list) == 1 and \ if len(old_line_list) == 1 and len(new_line_list) == 1 and \
new_line_list[0] == old_line_list[0].replace("BTrees._OOBTree","BTrees.OOBTree"): new_line_list[0] == old_line_list[0].replace("BTrees._OOBTree","BTrees.OOBTree"):
return True return True
return False return False
...@@ -6,12 +6,12 @@ new_group_list = new_line.split('"') ...@@ -6,12 +6,12 @@ new_group_list = new_line.split('"')
if len(new_group_list) != 5: if len(new_group_list) != 5:
return False return False
before, portal_type, module, erp5_portal_type, after = new_group_list before, _, module, erp5_portal_type, after = new_group_list
if before != '<global name=' or module != ' module=' or erp5_portal_type != 'erp5.portal_type' or after != '/>': if before != '<global name=' or module != ' module=' or erp5_portal_type != 'erp5.portal_type' or after != '/>':
return False return False
old_group_list = old_line_list[0].split('"') old_group_list = old_line_list[0].split('"')
if len(old_group_list) == 5: if len(old_group_list) == 5:
before2, ignore, module2, products_erp5type, after2 = old_group_list before2, _, module2, products_erp5type, after2 = old_group_list
return before2 == before and module2 == module and products_erp5type.startswith("Products.ERP5Type.Document.") and after2 == after return before2 == before and module2 == module and products_erp5type.startswith("Products.ERP5Type.Document.") and after2 == after
return False return False
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
<list> <list>
<string>my_parameter_signature</string> <string>my_parameter_signature</string>
<string>my_description</string> <string>my_description</string>
<string>error_message</string> <string>your_error_message</string>
<string>warning_message</string> <string>your_warning_message</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>error_message</string> </value> <value> <string>your_error_message</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>warning_message</string> </value> <value> <string>your_warning_message</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -107,10 +107,6 @@ ...@@ -107,10 +107,6 @@
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>id</string>
<string>ID</string>
</tuple>
<tuple> <tuple>
<string>reference</string> <string>reference</string>
<string>Reference</string> <string>Reference</string>
...@@ -119,10 +115,6 @@ ...@@ -119,10 +115,6 @@
<string>title</string> <string>title</string>
<string>Title</string> <string>Title</string>
</tuple> </tuple>
<tuple>
<string>callable_type</string>
<string>Callable Type</string>
</tuple>
<tuple> <tuple>
<string>parameter_signature</string> <string>parameter_signature</string>
<string>Parameters</string> <string>Parameters</string>
...@@ -186,10 +178,6 @@ ...@@ -186,10 +178,6 @@
<key> <string>url_columns</string> </key> <key> <string>url_columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>id</string>
<string>WorkflowScript_getListBoxURL</string>
</tuple>
<tuple> <tuple>
<string>reference</string> <string>reference</string>
<string>WorkflowScript_getListBoxURL</string> <string>WorkflowScript_getListBoxURL</string>
...@@ -198,10 +186,6 @@ ...@@ -198,10 +186,6 @@
<string>title</string> <string>title</string>
<string>WorkflowScript_getListBoxURL</string> <string>WorkflowScript_getListBoxURL</string>
</tuple> </tuple>
<tuple>
<string>callable_type</string>
<string>WorkflowScript_getListBoxURL</string>
</tuple>
<tuple> <tuple>
<string>parameter_signature</string> <string>parameter_signature</string>
<string>WorkflowScript_getListBoxURL</string> <string>WorkflowScript_getListBoxURL</string>
......
...@@ -58,7 +58,7 @@ def manage_page_footer(self): ...@@ -58,7 +58,7 @@ def manage_page_footer(self):
else: else:
mode = 'html' mode = 'html'
textarea_selector = 'textarea[name="filedata:text"]' textarea_selector = 'textarea[name="filedata:text"]'
elif document.meta_type in ('Script (Python)', ): elif document.meta_type in ('Script (Python)', 'ERP5 Python Script', 'ERP5 Workflow Script', ):
mode = 'python' mode = 'python'
textarea_selector = 'textarea[name="body:text"]' textarea_selector = 'textarea[name="body:text"]'
# printed is from RestrictedPython.RestrictionMutator the rest comes # printed is from RestrictedPython.RestrictionMutator the rest comes
...@@ -81,6 +81,10 @@ def manage_page_footer(self): ...@@ -81,6 +81,10 @@ def manage_page_footer(self):
mode = 'xml' mode = 'xml'
textarea_selector = 'textarea[name="text:text"]' textarea_selector = 'textarea[name="text:text"]'
if mode == 'plain_text':
if document.getId().endswith('.less'):
mode = 'less'
if not textarea_selector: if not textarea_selector:
return default return default
......
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