Commit 2af7cb79 authored by Julien Muchembled's avatar Julien Muchembled

BT: let ERP5Type initialize workflow method

parent b1fa10a8
...@@ -38,7 +38,6 @@ from AccessControl.SecurityInfo import ModuleSecurityInfo ...@@ -38,7 +38,6 @@ from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.PythonScript import PythonScript from Products.PythonScripts.PythonScript import PythonScript
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5Type.Base import WorkflowMethod
from Products.ERP5Type.Cache import transactional_cached from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type.Utils import readLocalDocument, \ from Products.ERP5Type.Utils import readLocalDocument, \
writeLocalDocument, \ writeLocalDocument, \
...@@ -4622,8 +4621,6 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4622,8 +4621,6 @@ Business Template is a set of definitions, such as skins, portal types and categ
item.is_bt_for_diff = 1 item.is_bt_for_diff = 1
item.build(self) item.build(self)
build = WorkflowMethod(build)
def publish(self, url, username=None, password=None): def publish(self, url, username=None, password=None):
""" """
Publish in a format or another Publish in a format or another
...@@ -4832,21 +4829,10 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4832,21 +4829,10 @@ Business Template is a set of definitions, such as skins, portal types and categ
site.portal_caches.clearAllCache() site.portal_caches.clearAllCache()
security.declareProtected(Permissions.ManagePortal, 'install') security.declareProtected(Permissions.ManagePortal, 'install')
def install(self, **kw): install = _install
"""
For install based on paramaters provided in **kw
"""
return self._install(**kw)
install = WorkflowMethod(install)
security.declareProtected(Permissions.ManagePortal, 'reinstall') security.declareProtected(Permissions.ManagePortal, 'reinstall')
def reinstall(self, **kw): reinstall = _install
"""Reinstall Business Template.
"""
return self._install(**kw)
reinstall = WorkflowMethod(reinstall)
security.declareProtected(Permissions.ManagePortal, 'trash') security.declareProtected(Permissions.ManagePortal, 'trash')
def trash(self, new_bt, **kw): def trash(self, new_bt, **kw):
...@@ -4864,8 +4850,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4864,8 +4850,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
self, self,
getattr(new_bt, item_name)) getattr(new_bt, item_name))
security.declareProtected(Permissions.ManagePortal, 'uninstall') def _uninstall(self, **kw):
def uninstall(self, **kw):
""" """
For uninstall based on paramaters provided in **kw For uninstall based on paramaters provided in **kw
""" """
...@@ -4879,9 +4864,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4879,9 +4864,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
# template deletes many things from the portal. # template deletes many things from the portal.
self.getPortalObject().portal_caches.clearAllCache() self.getPortalObject().portal_caches.clearAllCache()
uninstall = WorkflowMethod(uninstall) security.declareProtected(Permissions.ManagePortal, 'uninstall')
uninstall = _uninstall
security.declareProtected(Permissions.ManagePortal, 'clean')
def _clean(self): def _clean(self):
""" """
Clean built information. Clean built information.
...@@ -4902,7 +4887,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4902,7 +4887,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
for item_name in self._item_name_list: for item_name in self._item_name_list:
setattr(self, item_name, None) setattr(self, item_name, None)
clean = WorkflowMethod(_clean) security.declareProtected(Permissions.ManagePortal, 'clean')
clean = _clean
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getBuildingState') 'getBuildingState')
......
...@@ -1493,6 +1493,10 @@ class Base( CopyContainer, ...@@ -1493,6 +1493,10 @@ class Base( CopyContainer,
reindex_object=reindex_object, restricted=1, **kw) reindex_object=reindex_object, restricted=1, **kw)
# XXX Is this useful ? (Romain) # XXX Is this useful ? (Romain)
# Probably not. Even if it should speed up portal_type initialization and
# save some memory because edit_workflow is used in many places, I (jm)
# think it's negligible compared to the performance loss on all
# classes/types that are not bound to edit_workflow.
edit = WorkflowMethod(edit) edit = WorkflowMethod(edit)
# Accessing object property through ERP5ish interface # Accessing object property through ERP5ish interface
......
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