Commit a2f9eb22 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Ongoing development added to code base with switches in order not to break existing systems.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21412 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be2156bc
......@@ -28,22 +28,31 @@
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type import USE_BASE_TYPE
class PDFTypeInformation(XMLObject, 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
else:
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
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.
WARNING: the XMLObject inheritance is only there
to prevent breaking existing systems. It
must be removed from inheritance chain for this
class to be used. However, we are not planning to
commit it.
"""
# CMF Type Definition
meta_type = 'ERP5 PDF Type Information'
......
......@@ -39,6 +39,7 @@ from Products.CMFCore.utils import _checkPermission
from Products.ERP5Type import PropertySheet
from Products.ERP5Type import _dtmldir
from Products.ERP5Type import Permissions
from Products.ERP5Type import USE_BASE_TYPE
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
# Security uses ERP5Security by default
......@@ -65,7 +66,7 @@ from Products.CMFCore.exceptions import zExceptions_Unauthorized
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT = 'ERP5Type_asSecurityGroupId'
class ERP5TypeInformation( FactoryTypeInformation,
class ERP5TypeInformationMixIn( FactoryTypeInformation,
RoleProviderBase,
TranslationProviderBase ):
"""
......@@ -81,8 +82,8 @@ class ERP5TypeInformation( FactoryTypeInformation,
"""
__implements__ = ITypeInformation
meta_type = 'ERP5 Type Information'
security = ClassSecurityInfo()
manage_options = ( SimpleItemWithProperties.manage_options[:1]
......@@ -92,6 +93,7 @@ class ERP5TypeInformation( FactoryTypeInformation,
+ SimpleItemWithProperties.manage_options[1:]
)
if not USE_BASE_TYPE:
_properties = (TypeInformation._basic_properties + (
{'id':'factory', 'type': 'string', 'mode':'w',
'label':'Product factory method'},
......@@ -315,19 +317,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
return ob
security.declareProtected(Permissions.AccessContentsInformation,
'getPropertySheetList')
def getPropertySheetList( self ):
"""
Return list of content types.
XXX I (seb) think the name is bad
(jp) yes, the name is bad, it should be getAvailablePropertySheetList
"""
result = Products.ERP5Type.PropertySheet.__dict__.keys()
result = filter(lambda k: not k.startswith('__'), result)
result.sort()
return result
security.declareProtected(Permissions.ManagePortal,
'setPropertySheetList')
def setPropertySheetList( self, property_sheet_list):
......@@ -344,26 +333,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
"""
return self.hidden_content_type_list
security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategoryList')
def getBaseCategoryList( self ):
result = self.portal_categories.getBaseCategoryList()
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getConstraintList')
def getConstraintList( self ):
result = Products.ERP5Type.Constraint.__dict__.keys()
result = filter(lambda k: k != 'Constraint' and not k.startswith('__'),
result)
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getGroupList')
def getGroupList( self ):
return self.defined_group_list
security.declareProtected(Permissions.AccessContentsInformation,
'getInstanceBaseCategoryList')
......@@ -781,6 +750,106 @@ class ERP5TypeInformation( FactoryTypeInformation,
ri.getCondition(), ri.base_category_script ])
return ' '.join(search_source_list)
if USE_BASE_TYPE:
from Products.ERP5Type.XMLObject import XMLObject
class ERP5TypeInformation(XMLObject,
ERP5TypeInformationMixIn):
"""
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D
"""
portal_type = 'Base Type'
isPortalContent = 1
isRADContent = 1
security = ClassSecurityInfo()
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.SimpleItem
, PropertySheet.Folder
, PropertySheet.BaseType
)
def getTypeInfo(self, *args):
if not len(args):
return XMLObject.getTypeInfo(self)
else:
return self.getParentValue().getTypeInfo(self, args[0])
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalPropertySheetList')
def getPortalPropertySheetList( self ):
"""
Return list of content types.
XXX I (seb) think the name is bad
(jp) yes, the name is bad, it should be getAvailablePropertySheetList
"""
result = Products.ERP5Type.PropertySheet.__dict__.keys()
result = filter(lambda k: not k.startswith('__'), result)
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalBaseCategoryList')
def getPortalBaseCategoryList( self ):
result = self.portal_categories.getBaseCategoryList()
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalConstraintList')
def getPortalConstraintList( self ):
result = Products.ERP5Type.Constraint.__dict__.keys()
result = filter(lambda k: k != 'Constraint' and not k.startswith('__'),
result)
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalTypeGroupList')
def getPortalTypeGroupList( self ):
return self.defined_group_list
else:
class ERP5TypeInformation(ERP5TypeInformationMixIn):
security = ClassSecurityInfo()
security.declareProtected(Permissions.AccessContentsInformation,
'getPropertySheetList')
def getPropertySheetList( self ):
"""
Return list of content types.
XXX I (seb) think the name is bad
(jp) yes, the name is bad, it should be getAvailablePropertySheetList
"""
result = Products.ERP5Type.PropertySheet.__dict__.keys()
result = filter(lambda k: not k.startswith('__'), result)
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategoryList')
def getBaseCategoryList( self ):
result = self.portal_categories.getBaseCategoryList()
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getConstraintList')
def getConstraintList( self ):
result = Products.ERP5Type.Constraint.__dict__.keys()
result = filter(lambda k: k != 'Constraint' and not k.startswith('__'),
result)
result.sort()
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getGroupList')
def getGroupList( self ):
return self.defined_group_list
InitializeClass( ERP5TypeInformation )
......@@ -799,6 +868,3 @@ Products.CMFCore.TypesTool.typeClasses.append(
'action':'manage_addERP5TIForm',
'permission':'Manage portal'}, )
Products.CMFCore.TypesTool.TypesTool.manage_addERP5TIForm = manage_addERP5TIForm
# vim: filetype=python syntax=python shiftwidth=2
......@@ -24,7 +24,7 @@ from Acquisition import aq_base
class TypesTool(BaseTool, CMFCoreTypesTool):
"""
EXPERIMENTAL - DO NOT USE THIS PROPERTYSHEET BESIDES R&D
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D
"""
id = 'portal_types'
......
......@@ -29,6 +29,9 @@
ERP5Type is provides a RAD environment for Zope / CMF
All ERP5 classes derive from ERP5Type
"""
# Switch(es) for ongoing development which require single code base
USE_BASE_TYPE = False
USE_INTERACTOR = False
# Update ERP5 Globals
import sys, Permissions, os
......@@ -57,17 +60,23 @@ def allowClassTool():
def initialize( context ):
# Import Product Components
from Tool import ClassTool, CacheTool, MemcachedTool, SessionTool
if USE_BASE_TYPE:
from Tool import TypesTool
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)
portal_tools = ( ClassTool.ClassTool,
CacheTool.CacheTool,
MemcachedTool.MemcachedTool,
SessionTool.SessionTool )
SessionTool.SessionTool,
)
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,
......@@ -88,6 +97,9 @@ def initialize( context ):
# We should register local classes at some point
from Products.ERP5Type.Utils import initializeLocalDocumentRegistry
initializeLocalDocumentRegistry()
# Experimental Interactor
if USE_INTERACTOR:
import Interactor
from AccessControl.SecurityInfo import allow_module
from AccessControl.SecurityInfo import ModuleSecurityInfo
......
......@@ -16,8 +16,10 @@
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
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
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
......@@ -192,7 +194,8 @@ PropertyManager._propertyMap = PropertyManager_propertyMap
PropertyManager.propdict = PropertyManager_propdict
PropertyManager.hasProperty = PropertyManager_hasProperty
PropertyManager.getProperty = PropertyManager_getProperty
ERP5TypeInformation.manage_propertiesForm = PropertyManager_manage_propertiesForm
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