Commit 5be841c1 authored by Romain Courteaud's avatar Romain Courteaud

Add method updateCellRange which call automatically the correct _asCellRange...

Add method updateCellRange which call automatically the correct _asCellRange script and do a setCellRange.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2676 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9520b73c
...@@ -35,7 +35,7 @@ from Products.ERP5Type.Utils import cartesianProduct ...@@ -35,7 +35,7 @@ from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5Type.Base import TempBase from Products.ERP5Type.Base import TempBase
from zLOG import LOG from zLOG import LOG
from string import join from string import join, replace
class XMLMatrix(Folder): class XMLMatrix(Folder):
""" """
...@@ -312,6 +312,30 @@ class XMLMatrix(Folder): ...@@ -312,6 +312,30 @@ class XMLMatrix(Folder):
self._setCellRange(*kw, **kwd) self._setCellRange(*kw, **kwd)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'updateCellRange')
def updateCellRange(self, base_id):
"""
The asCellRange script if PT dependent
whoch is not the case with this kind of code
a better implementation consists in defining asCellRange as a generic method
at matrix level (OverridableMethod(portal_type))
which lookuops for scipt in class, meta_type and PT
form interaction could be implemented with interaction workflow
this method should be renamed updateCellRange or updateMatrixCellRange
base_id is parameter of updateCellRange
asCellRange scripts should be unified if possible
"""
script_name_end = '_asCellRange'
for script_name_begin in [self.getPortalType(), self.getMetaType(), self.__class__.__name__]:
script_name = join( [ replace(script_name_begin, ' ','') , script_name_end ], '')
if hasattr(self, script_name):
script = getattr(self, script_name)
break
cell_range = script(matrixbox=0)
self.setCellRange(base_id=base_id, *cell_range)
security.declareProtected( Permissions.ModifyPortalContent, '_renameCellRange' ) security.declareProtected( Permissions.ModifyPortalContent, '_renameCellRange' )
def _renameCellRange(self, *kw, **kwd): def _renameCellRange(self, *kw, **kwd):
""" """
......
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