Commit 2fe18740 authored by Aurel's avatar Aurel

raise error if no trash tool installed otherwise old objects are

deleted without backup, I will write a page on wiki to explain how to add
trash tool manually


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5301 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 25649bc8
...@@ -457,7 +457,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -457,7 +457,7 @@ class ObjectTemplateItem(BaseTemplateItem):
Backup the object in portal trash if necessery and return its subobjects Backup the object in portal trash if necessery and return its subobjects
""" """
subobjects_dict = {} subobjects_dict = {}
if trashbin is None: #m ust return subobjects if trashbin is None: # must return subobjects
object_path = container_path + [object_id] object_path = container_path + [object_id]
obj = self.unrestrictedTraverse(object_path) obj = self.unrestrictedTraverse(object_path)
for subobject_id in list(obj.objectIds()): for subobject_id in list(obj.objectIds()):
...@@ -3534,15 +3534,18 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3534,15 +3534,18 @@ Business Template is a set of definitions, such as skins, portal types and categ
Install a new Business Template, if force, all we be upgrade or installed Install a new Business Template, if force, all we be upgrade or installed
otherwise depends of dict object_to_update otherwise depends of dict object_to_update
""" """
installed_bt = self.portal_templates.getInstalledBusinessTemplate( installed_bt = self.portal_templates.getInstalledBusinessTemplate(
self.getTitle()) self.getTitle())
if installed_bt is not None: if installed_bt is not None:
if installed_bt.getTemplateFormatVersion() == 0: if installed_bt.getTemplateFormatVersion() == 0:
# maybe another to uninstall old format bt, maybe not needed
installed_bt.trash(self)
force = 1 force = 1
installed_bt.replace(self) installed_bt.replace(self)
trash_tool = getToolByName(self, 'portal_trash', None)
if trash_tool is None and self.getTemplateFormatVersion() == 1:
raise AttributeError, 'Trash Tool is not installed'
# Check the format of business template, if old, force install # Check the format of business template, if old, force install
if self.getTemplateFormatVersion() == 0: if self.getTemplateFormatVersion() == 0:
force = 1 force = 1
...@@ -3554,7 +3557,6 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3554,7 +3557,6 @@ Business Template is a set of definitions, such as skins, portal types and categ
if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool(): if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool():
LOG('Business Template', 0, 'Updating Activity Tool') LOG('Business Template', 0, 'Updating Activity Tool')
gen.setupLastTools(site, update=1, create_activities=1) gen.setupLastTools(site, update=1, create_activities=1)
if not force: if not force:
if len(object_to_update) == 0: if len(object_to_update) == 0:
# check if we have to update tools # check if we have to update tools
...@@ -3596,7 +3598,6 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3596,7 +3598,6 @@ Business Template is a set of definitions, such as skins, portal types and categ
# always created a trash bin because we may to save object already present # always created a trash bin because we may to save object already present
# but not in a previous business templates apart at creation of a new site # but not in a previous business templates apart at creation of a new site
trash_tool = getToolByName(self, 'portal_trash', None)
if trash_tool is not None and (len(object_to_update) > 0 or len(self.portal_templates.objectIds()) > 1): if trash_tool is not None and (len(object_to_update) > 0 or len(self.portal_templates.objectIds()) > 1):
trashbin = trash_tool.newTrashBin(self.getTitle(), self) trashbin = trash_tool.newTrashBin(self.getTitle(), self)
else: else:
......
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