diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index eda8f3e265d1e6ec68a9674b8342d40c44a1cd6d..9014dc7d8986c0ddf8d7bb7c95e08ee81b4fde7b 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -53,7 +53,7 @@ from Products.ERP5Type.Utils import readLocalTest, \ writeLocalTest, \ removeLocalTest from Products.ERP5Type.Utils import convertToUpperCase -from Products.ERP5Type import Permissions, PropertySheet, USE_BASE_TYPE +from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.Core.RoleInformation import RoleInformation from OFS.Traversable import NotFound @@ -2389,7 +2389,7 @@ class ActionTemplateItem(ObjectTemplateItem): url, value = id.split(' | ') url = posixpath.split(url) obj = p.unrestrictedTraverse(url) - is_new_action = USE_BASE_TYPE and obj.getParentId() == 'portal_types' + is_new_action = obj.getParentId() == 'portal_types' id_id = is_new_action and 'reference' or 'id' for action in obj.listActions(): if getattr(action, id_id) == value: @@ -2422,7 +2422,7 @@ class ActionTemplateItem(ObjectTemplateItem): path, id = id.rsplit('/', 1) container = p.unrestrictedTraverse(path) - if USE_BASE_TYPE and container.getParentId() == 'portal_types': + if container.getParentId() == 'portal_types': # XXX future BT should use 'reference' instead of 'id' reference = getattr(obj, 'reference', None) or obj.id portal_type_dict.setdefault(path, {})[reference] = obj diff --git a/product/ERP5/Document/PDFTypeInformation.py b/product/ERP5/Document/PDFTypeInformation.py index 6074b63c1b888b78fe1a11f5190304cf63a377ea..f83c98be7e600d51a5037cdd849d5e6dd0baa8f9 100644 --- a/product/ERP5/Document/PDFTypeInformation.py +++ b/product/ERP5/Document/PDFTypeInformation.py @@ -26,49 +26,23 @@ ############################################################################## from AccessControl import ClassSecurityInfo -from Products.CMFCore.utils import getToolByName -from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces -from Products.ERP5Type import USE_BASE_TYPE +from Products.ERP5Type import Permissions, PropertySheet +from Products.ERP5Type.ERP5Type import ERP5TypeInformation -if not USE_BASE_TYPE: - from Products.ERP5Type.XMLObject import XMLObject - - class PDFTypeInformation(XMLObject): - """ - Dummy class - """ - # CMF Type Definition - meta_type = 'ERP5 PDF Type Information' - portal_type = 'PDF Type' - isPortalContent = 1 - isRADContent = 1 +class PDFTypeInformation(ERP5TypeInformation): + """ + EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D -else: - from Products.ERP5Type.ERP5Type import ERP5TypeInformation + A Type Information class which (will) implement + all PDF Editor related methods in a more generic + way. + """ + # CMF Type Definition + meta_type = 'ERP5 PDF Type Information' + portal_type = 'PDF Type' + isPortalContent = 1 + isRADContent = 1 - class PDFTypeInformation(ERP5TypeInformation): - """ - EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D - - A Type Information class which (will) implement - all PDF Editor related methods in a more generic - way. - """ - # CMF Type Definition - meta_type = 'ERP5 PDF Type Information' - portal_type = 'PDF Type' - isPortalContent = 1 - isRADContent = 1 - - # Declarative security - security = ClassSecurityInfo() - security.declareObjectProtected(Permissions.AccessContentsInformation) - - # Default Properties - property_sheets = ( PropertySheet.Base - , PropertySheet.XMLObject - , PropertySheet.CategoryCore - , PropertySheet.SimpleItem - , PropertySheet.Folder - , PropertySheet.BaseType - ) + # Declarative security + security = ClassSecurityInfo() + security.declareObjectProtected(Permissions.AccessContentsInformation) diff --git a/product/ERP5Type/Core/ActionInformation.py b/product/ERP5Type/Core/ActionInformation.py index 74dde225320f5e45143e824239799df0b7a43edb..00b1e24f8f9c83d6e3564c7912d785d7b36d6bb2 100644 --- a/product/ERP5Type/Core/ActionInformation.py +++ b/product/ERP5Type/Core/ActionInformation.py @@ -39,7 +39,6 @@ from zLOG import LOG class ActionInformation(XMLObject): """ - EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D ActionInformation is an ERP5 type which will eventually replace respective ActionInformation from CMF. """ # XXX 'icon' property is not used. We can problably drop it. diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 7be8c4366c38250a56b8de0a5cd1513c844348fa..85de3dbd6064af546cace8dd6338b58faf38dc45 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -78,24 +78,23 @@ class LocalRoleAssignorMixIn(object): Assign Local Roles to Groups on object 'ob', based on Portal Type Role Definitions and "ERP5 Role Definition" objects contained inside 'ob'. """ - #FIXME We should check the type of the acl_users folder instead of - # checking which product is installed. if user_name is None: # First try to guess from the owner try: user_name = ob.getOwnerInfo()['id'] except (AttributeError, TypeError): pass - if user_name is None: - if ERP5UserManager is not None: - # We use id for roles in ERP5Security - user_name = getSecurityManager().getUser().getId() - elif NuxUserGroups is not None: - user_name = getSecurityManager().getUser().getUserName() - else: - raise RuntimeError, 'Product "ERP5Security" was not found on'\ - 'your setup. '\ - 'Please install it to benefit from group-based security' + if user_name is None: + #FIXME We should check the type of the acl_users folder instead of + # checking which product is installed. + if ERP5UserManager is not None: + # We use id for roles in ERP5Security + user_name = getSecurityManager().getUser().getId() + elif NuxUserGroups is not None: + user_name = getSecurityManager().getUser().getUserName() + else: + raise RuntimeError('Product "ERP5Security" was not found on your' + ' setup. Please install it to benefit from group-based security') group_id_role_dict = self.getLocalRolesFor(ob, user_name) @@ -179,8 +178,7 @@ class LocalRoleAssignorMixIn(object): """Return all Role Information objects stored on this portal type""" return self.objectValues(portal_type='Role Information') - security.declareProtected(Permissions.ModifyPortalContent, - 'updateRoleMapping') + security.declareProtected(Permissions.View, 'updateRoleMapping') def updateRoleMapping(self, REQUEST=None, form_id=''): """Update the local roles in existing objects. XXX This should be implemented the same way as diff --git a/product/ERP5Type/PropertySheet/ActionInformation.py b/product/ERP5Type/PropertySheet/ActionInformation.py index e137d0fe439358f4c312a46d7ab6bb5206c7b845..433bea28279893a64cd32f3ae96d5ca3b571e411 100644 --- a/product/ERP5Type/PropertySheet/ActionInformation.py +++ b/product/ERP5Type/PropertySheet/ActionInformation.py @@ -29,8 +29,7 @@ class ActionInformation: """ - EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D - Properties of an ERP5 Type action. + Properties of an ERP5 Action Information """ _properties = ( diff --git a/product/ERP5Type/PropertySheet/BaseType.py b/product/ERP5Type/PropertySheet/BaseType.py index d0fdec09927d92fadd612dd73ea07a5fb28bb5ed..ca40f370d5dd3fcfd8a7a033f2e30befb3982f42 100644 --- a/product/ERP5Type/PropertySheet/BaseType.py +++ b/product/ERP5Type/PropertySheet/BaseType.py @@ -28,7 +28,6 @@ class BaseType: """ - EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D Properties of an ERP5 portal type """ diff --git a/product/ERP5Type/PropertySheet/RoleInformation.py b/product/ERP5Type/PropertySheet/RoleInformation.py index e230e559df68a6322c82f9b795da62010ae3f873..9c67e20500b485a654959a54e024190e5cff516e 100644 --- a/product/ERP5Type/PropertySheet/RoleInformation.py +++ b/product/ERP5Type/PropertySheet/RoleInformation.py @@ -28,8 +28,7 @@ class RoleInformation: """ - EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D - Properties of an ERP5 Type Role Information + Properties of an ERP5 Role Information """ _properties = ( diff --git a/product/ERP5Type/PropertySheet/TranslationInformation.py b/product/ERP5Type/PropertySheet/TranslationInformation.py deleted file mode 100644 index 1b571ecf8cba9d214aed5e4fdbe43a791949a77a..0000000000000000000000000000000000000000 --- a/product/ERP5Type/PropertySheet/TranslationInformation.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################## -# -# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved. -# Jean-Paul Smets-Solanes <jp@nexedi.com> -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability 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 -# garantees 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -class TranslationInformation: - """ - EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D - Properties of an ERP5 Type Translation Information - """ - - _properties = ( - { 'id': 'property_name', - 'type': 'string', - 'description': 'The name of the property which can be translated.', - 'mode': 'w', - }, - { 'id': 'domain_name', - 'type': 'string', - 'description': 'The name of the translation domain to use for translation.', - 'mode': 'w', - }, - ) diff --git a/product/ERP5Type/Tool/TypesTool.py b/product/ERP5Type/Tool/TypesTool.py index e97bc45ca81f7b5407960c97c9d52a3297530e19..145af9cb335160eef030041a4fcf2e8cf39b91f8 100644 --- a/product/ERP5Type/Tool/TypesTool.py +++ b/product/ERP5Type/Tool/TypesTool.py @@ -29,8 +29,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from zLOG import LOG, WARNING, PANIC class TypesTool(BaseTool, CMFCore_TypesTool.TypesTool): - """ - EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D + """Provides a configurable registry of portal content types """ id = 'portal_types' meta_type = 'ERP5 Types Tool' diff --git a/product/ERP5Type/__init__.py b/product/ERP5Type/__init__.py index b6bc76602322157e01fc2a24d5c8f6b241cbc436..7b93cdb9918b8473212d80140169faf362e05335 100644 --- a/product/ERP5Type/__init__.py +++ b/product/ERP5Type/__init__.py @@ -30,7 +30,6 @@ All ERP5 classes derive from ERP5Type """ # Switch(es) for ongoing development which require single code base -USE_BASE_TYPE = True #False USE_INTERACTOR = False # Update ERP5 Globals @@ -60,25 +59,22 @@ def allowClassTool(): def initialize( context ): # Import Product Components - from Tool import ClassTool, CacheTool, MemcachedTool, SessionTool, WebServiceTool - if USE_BASE_TYPE: - from Tool import TypesTool + from Tool import (ClassTool, CacheTool, MemcachedTool, SessionTool, + TypesTool, WebServiceTool) import Document import Base, XMLObject from ERP5Type import ERP5TypeInformation # Define documents, classes, constructors and tools object_classes = () content_constructors = () - content_classes = ( Base.Base, XMLObject.XMLObject) + content_classes = Base.Base, XMLObject.XMLObject, ERP5TypeInformation portal_tools = ( ClassTool.ClassTool, CacheTool.CacheTool, MemcachedTool.MemcachedTool, SessionTool.SessionTool, + TypesTool.TypesTool, WebServiceTool.WebServiceTool, ) - if USE_BASE_TYPE: - content_classes = content_classes + (ERP5TypeInformation,) - portal_tools = portal_tools + (TypesTool.TypesTool, ) # Do initialization step initializeProduct(context, this_module, globals(), document_module = Document, diff --git a/product/ERP5Type/patches/PropertyManager.py b/product/ERP5Type/patches/PropertyManager.py index a1d2cbf5adb2c1026995be2a0b9b252c764c6dcc..99c4cba3474fcf488b83d0b5fb718c3d2242a994 100644 --- a/product/ERP5Type/patches/PropertyManager.py +++ b/product/ERP5Type/patches/PropertyManager.py @@ -16,10 +16,7 @@ from OFS.PropertyManager import PropertyManager, type_converters from OFS.PropertyManager import escape from Globals import DTMLFile -from Products.ERP5Type import USE_BASE_TYPE from Products.ERP5Type.Utils import createExpressionContext -if not USE_BASE_TYPE: - from Products.ERP5Type.ERP5Type import ERP5TypeInformation from Products.CMFCore.Expression import Expression from Products.ERP5Type import _dtmldir from Acquisition import aq_base @@ -197,8 +194,6 @@ PropertyManager._propertyMap = PropertyManager_propertyMap PropertyManager.propdict = PropertyManager_propdict PropertyManager.hasProperty = PropertyManager_hasProperty PropertyManager.getProperty = PropertyManager_getProperty -if not USE_BASE_TYPE: - ERP5TypeInformation.manage_propertiesForm = PropertyManager_manage_propertiesForm from ZPublisher.Converters import type_converters, field2string