Commit 3a59ff76 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Add 'Module Component' for non-Documents/non-persistent...

ZODB Components: Add 'Module Component' for non-Documents/non-persistent classes of modules usually found in Products.XXX on FS.

Also, considering that all other Components types are actually Modules, make
it the base class.
parent 50a8b88f
<?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>
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<item>Extension Component</item> <item>Extension Component</item>
<item>Interface Component</item> <item>Interface Component</item>
<item>Mixin Component</item> <item>Mixin Component</item>
<item>Module Component</item>
<item>Test Component</item> <item>Test Component</item>
</portal_type> </portal_type>
<portal_type id="Contribution Registry Tool"> <portal_type id="Contribution Registry Tool">
......
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
<portal_type id="Mixin Component"> <portal_type id="Mixin Component">
<item>SortIndex</item> <item>SortIndex</item>
</portal_type> </portal_type>
<portal_type id="Module Component">
<item>SortIndex</item>
</portal_type>
<portal_type id="Property Existence Constraint"> <portal_type id="Property Existence Constraint">
<item>ConstraintType</item> <item>ConstraintType</item>
</portal_type> </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>A Module Component is any non-persistent Module containing classes definitions (used to be found at the root of Products).</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>Module 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>ModuleComponent</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>
...@@ -123,6 +123,10 @@ ...@@ -123,6 +123,10 @@
<type>Mixin Component</type> <type>Mixin Component</type>
<workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow> <workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow>
</chain> </chain>
<chain>
<type>Module Component</type>
<workflow>component_validation_workflow, dynamic_class_generation_interaction_workflow, edit_workflow</workflow>
</chain>
<chain> <chain>
<type>Predicate</type> <type>Predicate</type>
<workflow>edit_workflow</workflow> <workflow>edit_workflow</workflow>
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<string>Extension Component</string> <string>Extension Component</string>
<string>Interface Component</string> <string>Interface Component</string>
<string>Mixin Component</string> <string>Mixin Component</string>
<string>Module Component</string>
<string>Test Component</string> <string>Test Component</string>
</list> </list>
</value> </value>
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<string>Extension Component</string> <string>Extension Component</string>
<string>Interface Component</string> <string>Interface Component</string>
<string>Mixin Component</string> <string>Mixin Component</string>
<string>Module Component</string>
<string>Test Component</string> <string>Test Component</string>
</list> </list>
</value> </value>
......
...@@ -89,6 +89,7 @@ Interface Component | view ...@@ -89,6 +89,7 @@ Interface Component | view
Memcached Plugin | view Memcached Plugin | view
Memcached Tool | view Memcached Tool | view
Mixin Component | view Mixin Component | view
Module Component | view
Predicate | view Predicate | view
Preference Tool Type | jump_property_sheets Preference Tool Type | jump_property_sheets
Preference Tool Type | view Preference Tool Type | view
......
...@@ -23,6 +23,7 @@ Component Tool | Document Component ...@@ -23,6 +23,7 @@ Component Tool | Document Component
Component Tool | Extension Component Component Tool | Extension Component
Component Tool | Interface Component Component Tool | Interface Component
Component Tool | Mixin Component Component Tool | Mixin Component
Component Tool | Module Component
Component Tool | Test Component Component Tool | Test Component
Contribution Registry Tool | Contribution Predicate Contribution Registry Tool | Contribution Predicate
Domain Tool | Base Domain Domain Tool | Base Domain
......
...@@ -53,6 +53,7 @@ Mapped Value ...@@ -53,6 +53,7 @@ Mapped Value
Memcached Plugin Memcached Plugin
Memcached Tool Memcached Tool
Mixin Component Mixin Component
Module Component
Movement Movement
Notification Tool Notification Tool
Order Tool Order Tool
......
...@@ -14,6 +14,7 @@ Document Component | SortIndex ...@@ -14,6 +14,7 @@ Document Component | SortIndex
Extension Component | SortIndex Extension Component | SortIndex
Interface Component | SortIndex Interface Component | SortIndex
Mixin Component | SortIndex Mixin Component | SortIndex
Module Component | SortIndex
Property Existence Constraint | ConstraintType Property Existence Constraint | ConstraintType
Property Type Validity Constraint | ConstraintType Property Type Validity Constraint | ConstraintType
Python Script | CatalogFilter Python Script | CatalogFilter
......
...@@ -40,6 +40,9 @@ Memcached Plugin | memcached_plugin_interaction_workflow ...@@ -40,6 +40,9 @@ Memcached Plugin | memcached_plugin_interaction_workflow
Mixin Component | component_validation_workflow Mixin Component | component_validation_workflow
Mixin Component | dynamic_class_generation_interaction_workflow Mixin Component | dynamic_class_generation_interaction_workflow
Mixin Component | edit_workflow Mixin Component | edit_workflow
Module Component | component_validation_workflow
Module Component | dynamic_class_generation_interaction_workflow
Module Component | edit_workflow
Predicate | edit_workflow Predicate | edit_workflow
Preference | edit_workflow Preference | edit_workflow
Preference | preference_workflow Preference | preference_workflow
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.mixin.component import ComponentMixin from Products.ERP5Type.Core.ModuleComponent import ModuleComponent
from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
...@@ -37,7 +37,7 @@ import zope.interface ...@@ -37,7 +37,7 @@ import zope.interface
import re import re
from Products.ERP5Type.interfaces.component import IComponent from Products.ERP5Type.interfaces.component import IComponent
class DocumentComponent(ComponentMixin, TextContentHistoryMixin): class DocumentComponent(ModuleComponent):
""" """
ZODB Component for Documents in bt5 only for now (which used to be installed ZODB Component for Documents in bt5 only for now (which used to be installed
in INSTANCE_HOME/Document) but this will also be used later on for Documents in INSTANCE_HOME/Document) but this will also be used later on for Documents
......
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.mixin.component import ComponentMixin from Products.ERP5Type.Core.ModuleComponent import ModuleComponent
from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
import zope.interface import zope.interface
from Products.ERP5Type.interfaces.component import IComponent from Products.ERP5Type.interfaces.component import IComponent
class ExtensionComponent(ComponentMixin, TextContentHistoryMixin): class ExtensionComponent(ModuleComponent):
""" """
ZODB Component for Extensions previously defined in the bt5 and installed in ZODB Component for Extensions previously defined in the bt5 and installed in
INSTANCE_HOME/Extensions INSTANCE_HOME/Extensions
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
# Arnaud Fontaine <arnaud.fontaine@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5Type.mixin.component import ComponentMixin
from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
import zope.interface
from Products.ERP5Type.interfaces.component import IComponent
class ModuleComponent(ComponentMixin, TextContentHistoryMixin):
"""
ZODB Component for Modules, eg non-Documents from Products, and the base
class for all other Components
"""
meta_type = 'ERP5 Module Component'
portal_type = 'Module Component'
zope.interface.implements(IComponent)
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@staticmethod
def _getFilesystemPath():
# TODO-arnau: useful?
raise NotImplementedError
@staticmethod
def _getDynamicModuleNamespace():
return 'erp5.component.module'
@staticmethod
def getIdPrefix():
return 'module'
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.mixin.component import ComponentMixin from Products.ERP5Type.Core.ModuleComponent import ModuleComponent
from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
import zope.interface import zope.interface
from Products.ERP5Type.interfaces.component import IComponent from Products.ERP5Type.interfaces.component import IComponent
class TestComponent(ComponentMixin, TextContentHistoryMixin): class TestComponent(ModuleComponent):
""" """
ZODB Component for Live Tests only (previously defined in the bt5 and ZODB Component for Live Tests only (previously defined in the bt5 and
installed in INSTANCE_HOME/tests) as other kind of Tests should be installed in INSTANCE_HOME/tests) as other kind of Tests should be
......
...@@ -180,6 +180,8 @@ def initializeDynamicModules(): ...@@ -180,6 +180,8 @@ def initializeDynamicModules():
holds accessors holders of Portal Types holds accessors holders of Portal Types
erp5.component: erp5.component:
holds ZODB Component packages holds ZODB Component packages
erp5.component.module:
holds Module (eg any module not being one of the following and used to be found in Products.NAME on FS)
erp5.component.document: erp5.component.document:
holds Document modules previously found in bt5 in $INSTANCE_HOME/Document holds Document modules previously found in bt5 in $INSTANCE_HOME/Document
erp5.component.interface: erp5.component.interface:
...@@ -234,6 +236,9 @@ def initializeDynamicModules(): ...@@ -234,6 +236,9 @@ def initializeDynamicModules():
erp5.accessor_holder.property_sheet erp5.accessor_holder.property_sheet
sys.modules["erp5.component"] = erp5.component sys.modules["erp5.component"] = erp5.component
erp5.component.module = ComponentDynamicPackage('erp5.component.module',
'Module Component')
erp5.component.extension = ComponentDynamicPackage('erp5.component.extension', erp5.component.extension = ComponentDynamicPackage('erp5.component.extension',
'Extension Component') 'Extension Component')
......
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