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, \
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
......
......@@ -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)
......@@ -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.
......
......@@ -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
......
......@@ -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 = (
......
......@@ -28,7 +28,6 @@
class BaseType:
"""
EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D
Properties of an ERP5 portal type
"""
......
......@@ -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 = (
......
##############################################################################
#
# 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
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'
......
......@@ -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,
......
......@@ -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
......
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