Commit e84d2b51 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Likewise Document, add Mixin (erp5.component.mixin) and...

ZODB Components: Likewise Document, add Mixin (erp5.component.mixin) and Interface (erp5.component.interface).

* One Mixin/Interface class per ZODB Component.
  => Already the case for FS Mixin, not for Interfaces.
* ZODB Components module name ('reference' property) and class name:
  + Mixin: FooMixin.
  + Interface: IFoo.

Rationale:
  + Avoid current FS hacks: registry (Mixins, mixin_class_registry) or import
    all classes explicitly in __init__.py (Products.ERP5Type.interfaces).
  + Consistent naming.
  + Consistent with ZODB Documents Components.

Also, modify pylint checker to handle Zope Interfaces:
  + E: 4, 0: Inheriting 'Interface', which is not a class. (inherit-non-class)
  + E: 5, 2: Method has no argument (no-method-argument)
parent c0cd8524
<tal:block tal:define='site_root python: here.getWebSiteValue() or here.getPortalObject();
portal_url python: site_root.absolute_url();
portal_type python: here.getPortalType();
div_id string:${id}_ace;
mode python: here.Base_getAceEditorMode();
container_div_id string:${div_id}_container;
......@@ -150,6 +151,7 @@
ace_editor_container_div = null;
ace_editor = null;
var mode = '${mode}';
var portal_type = '${portal_type}';
var params = '${params}';
function maximizeFullscreenRemoveSaveMessage() {
......@@ -394,6 +396,7 @@
ace.require('ace/ext/language_tools');
ace_editor.setOptions({ enableBasicAutocompletion: true, enableSnippets: true });
var data_options = {};
data_options.portal_type = portal_type;
if (params !== 'None') {
data_options.bound_names = ['context','container','script','traverse_subpath','printed','same_type','string','sequence','random','DateTime','whrandom','reorder','sets','test','math'],
data_options.params = params;
......
......@@ -200,7 +200,7 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
else:
body = data['code']
message_list = checkPythonSourceCode(body.encode('utf8'))
message_list = checkPythonSourceCode(body.encode('utf8'), data.get('portal_type'))
for message_dict in message_list:
if is_python_script:
message_dict['row'] = message_dict['row'] - 2
......
......@@ -444,7 +444,8 @@
update_check_running = false;
function checkPythonSourceCode(text, updateLinting, options, cm) {
update_check_text = text;
checker_parameters = {code: text};
checker_parameters = {code: text,
portal_type: '<dtml-var name="portal_type">'};
<dtml-if bound_names>
checker_parameters['bound_names'] = <dtml-var name="bound_names">;
checker_parameters['params'] = $('input[name="params"]').val();
......
This diff is collapsed.
......@@ -58,6 +58,8 @@ item_name_list = (
'workflow',
'product',
'document',
'interface',
'mixin',
'property_sheet',
'constraint',
'extension',
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ComponentMixin_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object is not None and not object.isWebMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ComponentMixin_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object is not None and not object.isWebMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -51,6 +51,8 @@
<portal_type id="Component Tool">
<item>Document Component</item>
<item>Extension Component</item>
<item>Interface Component</item>
<item>Mixin Component</item>
<item>Test Component</item>
</portal_type>
<portal_type id="Contribution Registry Tool">
......
......@@ -41,6 +41,12 @@
<portal_type id="Extension Component">
<item>SortIndex</item>
</portal_type>
<portal_type id="Interface Component">
<item>SortIndex</item>
</portal_type>
<portal_type id="Mixin Component">
<item>SortIndex</item>
</portal_type>
<portal_type id="Property Existence Constraint">
<item>ConstraintType</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>web_page.png</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Text Document</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>An Interface Component is just a specific Document Component for Zope Interfaces in ZODB. </string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addDocumentComponent</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>InterfaceComponent</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>web_page.png</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Text Document</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A Mixin Component is just a specific Document Component for ERP5 mixins in ZODB. </string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addDocumentComponent</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>MixinComponent</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -107,6 +107,10 @@
<type>Extension Component</type>
<workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow>
</chain>
<chain>
<type>Interface Component</type>
<workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow>
</chain>
<chain>
<type>Mapped Value</type>
<workflow>edit_workflow</workflow>
......@@ -115,6 +119,10 @@
<type>Memcached Plugin</type>
<workflow>memcached_plugin_interaction_workflow</workflow>
</chain>
<chain>
<type>Mixin Component</type>
<workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow>
</chain>
<chain>
<type>Predicate</type>
<workflow>edit_workflow</workflow>
......
......@@ -64,6 +64,8 @@
<list>
<string>my_template_role_list</string>
<string>my_template_site_property_id_list</string>
<string>my_template_interface_id_list</string>
<string>my_template_mixin_id_list</string>
<string>my_template_document_id_list</string>
<string>my_template_property_sheet_id_list</string>
<string>my_template_extension_id_list</string>
......
......@@ -72,6 +72,8 @@
<list>
<string>Document Component</string>
<string>Extension Component</string>
<string>Interface Component</string>
<string>Mixin Component</string>
<string>Test Component</string>
</list>
</value>
......
......@@ -71,10 +71,18 @@
<list>
<string>Document Component</string>
<string>Extension Component</string>
<string>Interface Component</string>
<string>Mixin Component</string>
<string>Test Component</string>
</list>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
......
......@@ -85,8 +85,10 @@ Dynamic Category Property | view
Extension Component | view
Folder | view
Id Tool | view
Interface Component | view
Memcached Plugin | view
Memcached Tool | view
Mixin Component | view
Predicate | view
Preference Tool Type | jump_property_sheets
Preference Tool Type | view
......
......@@ -21,6 +21,8 @@ Category Tool | Base Category
Category | Category
Component Tool | Document Component
Component Tool | Extension Component
Component Tool | Interface Component
Component Tool | Mixin Component
Component Tool | Test Component
Contribution Registry Tool | Contribution Predicate
Domain Tool | Base Domain
......
......@@ -48,9 +48,11 @@ Event
Extension Component
Folder
Id Tool
Interface Component
Mapped Value
Memcached Plugin
Memcached Tool
Mixin Component
Movement
Notification Tool
Order Tool
......
......@@ -12,6 +12,8 @@ Category Related Membership State Constraint | ConstraintType
Content Existence Constraint | ConstraintType
Document Component | SortIndex
Extension Component | SortIndex
Interface Component | SortIndex
Mixin Component | SortIndex
Property Existence Constraint | ConstraintType
Property Type Validity Constraint | ConstraintType
Python Script | CatalogFilter
......
......@@ -32,8 +32,14 @@ Dynamic Category Property | dynamic_class_generation_interaction_workflow
Extension Component | component_validation_workflow
Extension Component | dynamic_class_generation_interaction_workflow
Extension Component | edit_workflow
Interface Component | component_validation_workflow
Interface Component | dynamic_class_generation_interaction_workflow
Interface Component | edit_workflow
Mapped Value | edit_workflow
Memcached Plugin | memcached_plugin_interaction_workflow
Mixin Component | component_validation_workflow
Mixin Component | dynamic_class_generation_interaction_workflow
Mixin Component | edit_workflow
Predicate | edit_workflow
Preference | edit_workflow
Preference | preference_workflow
......