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,14 @@ ...@@ -28,22 +28,14 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type import USE_BASE_TYPE
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
class PDFTypeInformation(XMLObject, ERP5TypeInformation): if not USE_BASE_TYPE:
from Products.ERP5Type.XMLObject import XMLObject
class PDFTypeInformation(XMLObject):
""" """
EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D Dummy class
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 # CMF Type Definition
meta_type = 'ERP5 PDF Type Information' meta_type = 'ERP5 PDF Type Information'
...@@ -51,15 +43,32 @@ class PDFTypeInformation(XMLObject, ERP5TypeInformation): ...@@ -51,15 +43,32 @@ class PDFTypeInformation(XMLObject, ERP5TypeInformation):
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
# Declarative security else:
security = ClassSecurityInfo() from Products.ERP5Type.ERP5Type import ERP5TypeInformation
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties class PDFTypeInformation(ERP5TypeInformation):
property_sheets = ( PropertySheet.Base """
, PropertySheet.XMLObject EXPERIMENTAL - DO NOT USE THIS CLASS BESIDES R&D
, PropertySheet.CategoryCore
, PropertySheet.SimpleItem A Type Information class which (will) implement
, PropertySheet.Folder all PDF Editor related methods in a more generic
, PropertySheet.BaseType 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,6 +39,7 @@ from Products.CMFCore.utils import _checkPermission ...@@ -39,6 +39,7 @@ from Products.CMFCore.utils import _checkPermission
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from Products.ERP5Type import _dtmldir from Products.ERP5Type import _dtmldir
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type import USE_BASE_TYPE
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
# Security uses ERP5Security by default # Security uses ERP5Security by default
...@@ -65,9 +66,9 @@ from Products.CMFCore.exceptions import zExceptions_Unauthorized ...@@ -65,9 +66,9 @@ from Products.CMFCore.exceptions import zExceptions_Unauthorized
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT = 'ERP5Type_asSecurityGroupId' ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT = 'ERP5Type_asSecurityGroupId'
class ERP5TypeInformation( FactoryTypeInformation, class ERP5TypeInformationMixIn( FactoryTypeInformation,
RoleProviderBase, RoleProviderBase,
TranslationProviderBase ): TranslationProviderBase ):
""" """
ERP5 Types are based on FactoryTypeInformation ERP5 Types are based on FactoryTypeInformation
...@@ -81,8 +82,8 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -81,8 +82,8 @@ class ERP5TypeInformation( FactoryTypeInformation,
""" """
__implements__ = ITypeInformation __implements__ = ITypeInformation
meta_type = 'ERP5 Type Information' meta_type = 'ERP5 Type Information'
security = ClassSecurityInfo() security = ClassSecurityInfo()
manage_options = ( SimpleItemWithProperties.manage_options[:1] manage_options = ( SimpleItemWithProperties.manage_options[:1]
...@@ -92,7 +93,8 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -92,7 +93,8 @@ class ERP5TypeInformation( FactoryTypeInformation,
+ SimpleItemWithProperties.manage_options[1:] + SimpleItemWithProperties.manage_options[1:]
) )
_properties = (TypeInformation._basic_properties + ( if not USE_BASE_TYPE:
_properties = (TypeInformation._basic_properties + (
{'id':'factory', 'type': 'string', 'mode':'w', {'id':'factory', 'type': 'string', 'mode':'w',
'label':'Product factory method'}, 'label':'Product factory method'},
{'id':'permission', 'type': 'string', 'mode':'w', {'id':'permission', 'type': 'string', 'mode':'w',
...@@ -315,19 +317,6 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -315,19 +317,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
return ob 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, security.declareProtected(Permissions.ManagePortal,
'setPropertySheetList') 'setPropertySheetList')
def setPropertySheetList( self, property_sheet_list): def setPropertySheetList( self, property_sheet_list):
...@@ -344,26 +333,6 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -344,26 +333,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
""" """
return self.hidden_content_type_list 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, security.declareProtected(Permissions.AccessContentsInformation,
'getInstanceBaseCategoryList') 'getInstanceBaseCategoryList')
...@@ -780,7 +749,107 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -780,7 +749,107 @@ class ERP5TypeInformation( FactoryTypeInformation,
search_source_list.extend([ri.id, ri.title, ri.description, search_source_list.extend([ri.id, ri.title, ri.description,
ri.getCondition(), ri.base_category_script ]) ri.getCondition(), ri.base_category_script ])
return ' '.join(search_source_list) 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 ) InitializeClass( ERP5TypeInformation )
...@@ -799,6 +868,3 @@ Products.CMFCore.TypesTool.typeClasses.append( ...@@ -799,6 +868,3 @@ Products.CMFCore.TypesTool.typeClasses.append(
'action':'manage_addERP5TIForm', 'action':'manage_addERP5TIForm',
'permission':'Manage portal'}, ) 'permission':'Manage portal'}, )
Products.CMFCore.TypesTool.TypesTool.manage_addERP5TIForm = manage_addERP5TIForm Products.CMFCore.TypesTool.TypesTool.manage_addERP5TIForm = manage_addERP5TIForm
# vim: filetype=python syntax=python shiftwidth=2
...@@ -24,7 +24,7 @@ from Acquisition import aq_base ...@@ -24,7 +24,7 @@ from Acquisition import aq_base
class TypesTool(BaseTool, CMFCoreTypesTool): 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' id = 'portal_types'
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
ERP5Type is provides a RAD environment for Zope / CMF ERP5Type is provides a RAD environment for Zope / CMF
All ERP5 classes derive from ERP5Type 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 # Update ERP5 Globals
import sys, Permissions, os import sys, Permissions, os
...@@ -57,17 +60,23 @@ def allowClassTool(): ...@@ -57,17 +60,23 @@ def allowClassTool():
def initialize( context ): def initialize( context ):
# Import Product Components # Import Product Components
from Tool import ClassTool, CacheTool, MemcachedTool, SessionTool from Tool import ClassTool, CacheTool, MemcachedTool, SessionTool
if USE_BASE_TYPE:
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)
portal_tools = ( ClassTool.ClassTool, portal_tools = ( ClassTool.ClassTool,
CacheTool.CacheTool, CacheTool.CacheTool,
MemcachedTool.MemcachedTool, MemcachedTool.MemcachedTool,
SessionTool.SessionTool ) SessionTool.SessionTool,
)
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,
...@@ -88,6 +97,9 @@ def initialize( context ): ...@@ -88,6 +97,9 @@ def initialize( context ):
# We should register local classes at some point # We should register local classes at some point
from Products.ERP5Type.Utils import initializeLocalDocumentRegistry from Products.ERP5Type.Utils import initializeLocalDocumentRegistry
initializeLocalDocumentRegistry() initializeLocalDocumentRegistry()
# Experimental Interactor
if USE_INTERACTOR:
import Interactor
from AccessControl.SecurityInfo import allow_module from AccessControl.SecurityInfo import allow_module
from AccessControl.SecurityInfo import ModuleSecurityInfo from AccessControl.SecurityInfo import ModuleSecurityInfo
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
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
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.CMFCore.Expression import Expression
from Products.ERP5Type import _dtmldir from Products.ERP5Type import _dtmldir
from Acquisition import aq_base from Acquisition import aq_base
...@@ -192,7 +194,8 @@ PropertyManager._propertyMap = PropertyManager_propertyMap ...@@ -192,7 +194,8 @@ 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
ERP5TypeInformation.manage_propertiesForm = PropertyManager_manage_propertiesForm 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