[Erp5-report] r21411 - in /erp5/trunk/products/ERP5Type: ./ Tool/ patches/
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Jun 8 21:20:54 CEST 2008
Author: jp
Date: Sun Jun 8 21:20:54 2008
New Revision: 21411
URL: http://svn.erp5.org?rev=21411&view=rev
Log:
Ongoing development added to code base with switches in order not to break existing systems.
Modified:
erp5/trunk/products/ERP5Type/ERP5Type.py
erp5/trunk/products/ERP5Type/Tool/TypesTool.py
erp5/trunk/products/ERP5Type/__init__.py
erp5/trunk/products/ERP5Type/patches/PropertyManager.py
Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=21411&r1=21410&r2=21411&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py Sun Jun 8 21:20:54 2008
@@ -39,6 +39,7 @@
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,9 +66,9 @@
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT = 'ERP5Type_asSecurityGroupId'
-class ERP5TypeInformation( FactoryTypeInformation,
- RoleProviderBase,
- TranslationProviderBase ):
+class ERP5TypeInformationMixIn( FactoryTypeInformation,
+ RoleProviderBase,
+ TranslationProviderBase ):
"""
ERP5 Types are based on FactoryTypeInformation
@@ -81,8 +82,8 @@
"""
__implements__ = ITypeInformation
-
meta_type = 'ERP5 Type Information'
+
security = ClassSecurityInfo()
manage_options = ( SimpleItemWithProperties.manage_options[:1]
@@ -92,7 +93,8 @@
+ SimpleItemWithProperties.manage_options[1:]
)
- _properties = (TypeInformation._basic_properties + (
+ if not USE_BASE_TYPE:
+ _properties = (TypeInformation._basic_properties + (
{'id':'factory', 'type': 'string', 'mode':'w',
'label':'Product factory method'},
{'id':'permission', 'type': 'string', 'mode':'w',
@@ -315,19 +317,6 @@
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 @@
"""
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')
@@ -780,7 +749,107 @@
search_source_list.extend([ri.id, ri.title, ri.description,
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 @@
'action':'manage_addERP5TIForm',
'permission':'Manage portal'}, )
Products.CMFCore.TypesTool.TypesTool.manage_addERP5TIForm = manage_addERP5TIForm
-
-
-# vim: filetype=python syntax=python shiftwidth=2
Modified: erp5/trunk/products/ERP5Type/Tool/TypesTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/TypesTool.py?rev=21411&r1=21410&r2=21411&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/TypesTool.py (original)
+++ erp5/trunk/products/ERP5Type/Tool/TypesTool.py Sun Jun 8 21:20:54 2008
@@ -24,7 +24,7 @@
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'
Modified: erp5/trunk/products/ERP5Type/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/__init__.py?rev=21411&r1=21410&r2=21411&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/__init__.py (original)
+++ erp5/trunk/products/ERP5Type/__init__.py Sun Jun 8 21:20:54 2008
@@ -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 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 @@
# 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
Modified: erp5/trunk/products/ERP5Type/patches/PropertyManager.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/PropertyManager.py?rev=21411&r1=21410&r2=21411&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/PropertyManager.py (original)
+++ erp5/trunk/products/ERP5Type/patches/PropertyManager.py Sun Jun 8 21:20:54 2008
@@ -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.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
More information about the Erp5-report
mailing list