Commit f8cba738 authored by Nicolas Dumazet's avatar Nicolas Dumazet

pass name arguments to PropertyHolder and avoid a property_sheet_id argument

in _createAccessorHolderFromPropertyHolder


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42808 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1757c60a
......@@ -185,7 +185,7 @@ class PropertySheetTool(BaseTool):
XXX: Workflows?
XXX: Remove as soon as the migration is finished
"""
property_holder = PropertyHolder()
property_holder = PropertyHolder(property_sheet.__name__)
property_holder._properties = getattr(property_sheet, '_properties', [])
property_holder._categories = getattr(property_sheet, '_categories', [])
......@@ -194,7 +194,6 @@ class PropertySheetTool(BaseTool):
return _createCommonPropertySheetAccessorHolder(
self.getPortalObject(),
property_holder,
property_sheet.__name__,
'erp5.filesystem_accessor_holder')
security.declarePrivate('createZodbPropertySheetAccessorHolder')
......@@ -208,20 +207,17 @@ class PropertySheetTool(BaseTool):
definition_tuple = \
self.exportPropertySheetToFilesystemDefinitionTuple(property_sheet)
property_holder = PropertyHolder()
property_sheet_name = property_sheet.getId()
property_holder = PropertyHolder(property_sheet_name)
# Prepare the Property Holder
property_holder._properties, \
property_holder._categories, \
property_holder._constraints = definition_tuple
property_sheet_name = property_sheet.getId()
property_holder.__name__ = property_sheet_name
return _createAccessorHolderFromPropertyHolder(
self.getPortalObject(),
property_holder,
property_sheet_name,
'erp5.accessor_holder')
security.declareProtected(Permissions.ManagePortal,
......
......@@ -43,15 +43,15 @@ from Products.ERP5Type.Globals import InitializeClass
from zLOG import LOG, ERROR, INFO
def _createAccessorHolderFromPropertyHolder(portal,
property_holder,
property_sheet_id,
def _createAccessorHolderFromPropertyHolder(property_holder,
portal,
accessor_holder_module_name):
"""
Create a new accessor holder class from the given Property Holder
within the given accessor holder module (when the migration will
be finished, there should only be one accessor holder module)
"""
property_sheet_id = property_holder.__name__
setDefaultClassProperties(property_holder)
try:
......@@ -128,7 +128,7 @@ def _generateBaseAccessorHolder(portal,
base_category_list = portal_categories.objectIds()
property_holder = PropertyHolder()
property_holder = PropertyHolder(base_accessor_holder_id)
econtext = createExpressionContext(portal, portal)
createRelatedAccessors(portal_categories,
......@@ -137,9 +137,8 @@ def _generateBaseAccessorHolder(portal,
base_category_list)
accessor_holder = _createAccessorHolderFromPropertyHolder(
portal,
property_holder,
base_accessor_holder_id,
portal,
'erp5.accessor_holder',
skip_default=True)
setattr(accessor_holder_module, base_accessor_holder_id, accessor_holder)
......@@ -148,7 +147,7 @@ def _generateBaseAccessorHolder(portal,
def _generatePreferenceToolAccessorHolder(portal, accessor_holder_list,
accessor_holder_module):
property_holder = PropertyHolder()
property_holder = PropertyHolder('PreferenceTool')
from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5Type.Utils import convertToUpperCase
......@@ -174,9 +173,8 @@ def _generatePreferenceToolAccessorHolder(portal, accessor_holder_list,
property_holder.declareProtected(read_permission, attribute_name)
accessor_holder = _createAccessorHolderFromPropertyHolder(
portal,
property_holder,
'PreferenceTool',
portal,
'erp5.accessor_holder',
skip_default=True)
setattr(accessor_holder_module, 'PreferenceTool', accessor_holder)
......
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