Commit 94150f3a authored by Julien Muchembled's avatar Julien Muchembled

Drop USE_BASE_TYPE switch and TranslationInformation property sheet

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29255 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fddb39e7
...@@ -53,7 +53,7 @@ from Products.ERP5Type.Utils import readLocalTest, \ ...@@ -53,7 +53,7 @@ from Products.ERP5Type.Utils import readLocalTest, \
writeLocalTest, \ writeLocalTest, \
removeLocalTest removeLocalTest
from Products.ERP5Type.Utils import convertToUpperCase 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.XMLObject import XMLObject
from Products.ERP5Type.Core.RoleInformation import RoleInformation from Products.ERP5Type.Core.RoleInformation import RoleInformation
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
...@@ -2389,7 +2389,7 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -2389,7 +2389,7 @@ class ActionTemplateItem(ObjectTemplateItem):
url, value = id.split(' | ') url, value = id.split(' | ')
url = posixpath.split(url) url = posixpath.split(url)
obj = p.unrestrictedTraverse(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' id_id = is_new_action and 'reference' or 'id'
for action in obj.listActions(): for action in obj.listActions():
if getattr(action, id_id) == value: if getattr(action, id_id) == value:
...@@ -2422,7 +2422,7 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -2422,7 +2422,7 @@ class ActionTemplateItem(ObjectTemplateItem):
path, id = id.rsplit('/', 1) path, id = id.rsplit('/', 1)
container = p.unrestrictedTraverse(path) 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' # XXX future BT should use 'reference' instead of 'id'
reference = getattr(obj, 'reference', None) or obj.id reference = getattr(obj, 'reference', None) or obj.id
portal_type_dict.setdefault(path, {})[reference] = obj portal_type_dict.setdefault(path, {})[reference] = obj
......
...@@ -26,49 +26,23 @@ ...@@ -26,49 +26,23 @@
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type import USE_BASE_TYPE
if not USE_BASE_TYPE: class PDFTypeInformation(ERP5TypeInformation):
from Products.ERP5Type.XMLObject import XMLObject """
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D
class PDFTypeInformation(XMLObject):
"""
Dummy class
"""
# CMF Type Definition
meta_type = 'ERP5 PDF Type Information'
portal_type = 'PDF Type'
isPortalContent = 1
isRADContent = 1
else: A Type Information class which (will) implement
from Products.ERP5Type.ERP5Type import ERP5TypeInformation 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): # Declarative security
""" security = ClassSecurityInfo()
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D security.declareObjectProtected(Permissions.AccessContentsInformation)
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
)
...@@ -39,7 +39,6 @@ from zLOG import LOG ...@@ -39,7 +39,6 @@ from zLOG import LOG
class ActionInformation(XMLObject): 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. ActionInformation is an ERP5 type which will eventually replace respective ActionInformation from CMF.
""" """
# XXX 'icon' property is not used. We can problably drop it. # XXX 'icon' property is not used. We can problably drop it.
......
...@@ -78,24 +78,23 @@ class LocalRoleAssignorMixIn(object): ...@@ -78,24 +78,23 @@ class LocalRoleAssignorMixIn(object):
Assign Local Roles to Groups on object 'ob', based on Portal Type Role Assign Local Roles to Groups on object 'ob', based on Portal Type Role
Definitions and "ERP5 Role Definition" objects contained inside 'ob'. 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: if user_name is None:
# First try to guess from the owner # First try to guess from the owner
try: try:
user_name = ob.getOwnerInfo()['id'] user_name = ob.getOwnerInfo()['id']
except (AttributeError, TypeError): except (AttributeError, TypeError):
pass pass
if user_name is None: if user_name is None:
if ERP5UserManager is not None: #FIXME We should check the type of the acl_users folder instead of
# We use id for roles in ERP5Security # checking which product is installed.
user_name = getSecurityManager().getUser().getId() if ERP5UserManager is not None:
elif NuxUserGroups is not None: # We use id for roles in ERP5Security
user_name = getSecurityManager().getUser().getUserName() user_name = getSecurityManager().getUser().getId()
else: elif NuxUserGroups is not None:
raise RuntimeError, 'Product "ERP5Security" was not found on'\ user_name = getSecurityManager().getUser().getUserName()
'your setup. '\ else:
'Please install it to benefit from group-based security' 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) group_id_role_dict = self.getLocalRolesFor(ob, user_name)
...@@ -179,8 +178,7 @@ class LocalRoleAssignorMixIn(object): ...@@ -179,8 +178,7 @@ class LocalRoleAssignorMixIn(object):
"""Return all Role Information objects stored on this portal type""" """Return all Role Information objects stored on this portal type"""
return self.objectValues(portal_type='Role Information') return self.objectValues(portal_type='Role Information')
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.View, 'updateRoleMapping')
'updateRoleMapping')
def updateRoleMapping(self, REQUEST=None, form_id=''): def updateRoleMapping(self, REQUEST=None, form_id=''):
"""Update the local roles in existing objects. """Update the local roles in existing objects.
XXX This should be implemented the same way as XXX This should be implemented the same way as
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
class ActionInformation: class ActionInformation:
""" """
EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D Properties of an ERP5 Action Information
Properties of an ERP5 Type action.
""" """
_properties = ( _properties = (
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
class BaseType: class BaseType:
""" """
EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D
Properties of an ERP5 portal type Properties of an ERP5 portal type
""" """
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
class RoleInformation: class RoleInformation:
""" """
EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D Properties of an ERP5 Role Information
Properties of an ERP5 Type Role Information
""" """
_properties = ( _properties = (
......
##############################################################################
#
# 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',
},
)
...@@ -29,8 +29,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod ...@@ -29,8 +29,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from zLOG import LOG, WARNING, PANIC from zLOG import LOG, WARNING, PANIC
class TypesTool(BaseTool, CMFCore_TypesTool.TypesTool): class TypesTool(BaseTool, CMFCore_TypesTool.TypesTool):
""" """Provides a configurable registry of portal content types
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D
""" """
id = 'portal_types' id = 'portal_types'
meta_type = 'ERP5 Types Tool' meta_type = 'ERP5 Types Tool'
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
All ERP5 classes derive from ERP5Type All ERP5 classes derive from ERP5Type
""" """
# Switch(es) for ongoing development which require single code base # Switch(es) for ongoing development which require single code base
USE_BASE_TYPE = True #False
USE_INTERACTOR = False USE_INTERACTOR = False
# Update ERP5 Globals # Update ERP5 Globals
...@@ -60,25 +59,22 @@ def allowClassTool(): ...@@ -60,25 +59,22 @@ def allowClassTool():
def initialize( context ): def initialize( context ):
# Import Product Components # Import Product Components
from Tool import ClassTool, CacheTool, MemcachedTool, SessionTool, WebServiceTool from Tool import (ClassTool, CacheTool, MemcachedTool, SessionTool,
if USE_BASE_TYPE: TypesTool, WebServiceTool)
from Tool import TypesTool
import Document import Document
import Base, XMLObject import Base, XMLObject
from ERP5Type import ERP5TypeInformation from ERP5Type import ERP5TypeInformation
# Define documents, classes, constructors and tools # Define documents, classes, constructors and tools
object_classes = () object_classes = ()
content_constructors = () content_constructors = ()
content_classes = ( Base.Base, XMLObject.XMLObject) content_classes = Base.Base, XMLObject.XMLObject, ERP5TypeInformation
portal_tools = ( ClassTool.ClassTool, portal_tools = ( ClassTool.ClassTool,
CacheTool.CacheTool, CacheTool.CacheTool,
MemcachedTool.MemcachedTool, MemcachedTool.MemcachedTool,
SessionTool.SessionTool, SessionTool.SessionTool,
TypesTool.TypesTool,
WebServiceTool.WebServiceTool, WebServiceTool.WebServiceTool,
) )
if USE_BASE_TYPE:
content_classes = content_classes + (ERP5TypeInformation,)
portal_tools = portal_tools + (TypesTool.TypesTool, )
# Do initialization step # Do initialization step
initializeProduct(context, this_module, globals(), initializeProduct(context, this_module, globals(),
document_module = Document, document_module = Document,
......
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
from OFS.PropertyManager import PropertyManager, type_converters from OFS.PropertyManager import PropertyManager, type_converters
from OFS.PropertyManager import escape from OFS.PropertyManager import escape
from Globals import DTMLFile from Globals import DTMLFile
from Products.ERP5Type import USE_BASE_TYPE
from Products.ERP5Type.Utils import createExpressionContext 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.CMFCore.Expression import Expression
from Products.ERP5Type import _dtmldir from Products.ERP5Type import _dtmldir
from Acquisition import aq_base from Acquisition import aq_base
...@@ -197,8 +194,6 @@ PropertyManager._propertyMap = PropertyManager_propertyMap ...@@ -197,8 +194,6 @@ PropertyManager._propertyMap = PropertyManager_propertyMap
PropertyManager.propdict = PropertyManager_propdict PropertyManager.propdict = PropertyManager_propdict
PropertyManager.hasProperty = PropertyManager_hasProperty PropertyManager.hasProperty = PropertyManager_hasProperty
PropertyManager.getProperty = PropertyManager_getProperty PropertyManager.getProperty = PropertyManager_getProperty
if not USE_BASE_TYPE:
ERP5TypeInformation.manage_propertiesForm = PropertyManager_manage_propertiesForm
from ZPublisher.Converters import type_converters, field2string from ZPublisher.Converters import type_converters, field2string
......
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