Commit ff8cf9e0 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

if installed_bt is already in 'replaced' state (that can happen when only...

if installed_bt is already in 'replaced' state (that can happen when only replaces ones exist), we cannot not call replace() again on it.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36757 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee429cf7
...@@ -5250,15 +5250,18 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5250,15 +5250,18 @@ Business Template is a set of definitions, such as skins, portal types and categ
else: else:
object_to_update = {} object_to_update = {}
installed_bt = self.portal_templates.getInstalledBusinessTemplate( site = self.getPortalObject()
installed_bt = site.portal_templates.getInstalledBusinessTemplate(
self.getTitle()) self.getTitle())
# When reinstalling, installation state should not change to replaced # When reinstalling, installation state should not change to replaced
if installed_bt not in [None, self]: if installed_bt not in [None, self]:
if installed_bt.getTemplateFormatVersion() == 0: if installed_bt.getTemplateFormatVersion() == 0:
force = 1 force = 1
if site.portal_workflow.isTransitionPossible(
installed_bt, 'replace'):
installed_bt.replace(self) installed_bt.replace(self)
trash_tool = getToolByName(self, 'portal_trash', None) trash_tool = getToolByName(site, 'portal_trash', None)
if trash_tool is None and self.getTemplateFormatVersion() == 1: if trash_tool is None and self.getTemplateFormatVersion() == 1:
raise AttributeError, 'Trash Tool is not installed' raise AttributeError, 'Trash Tool is not installed'
...@@ -5269,7 +5272,6 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5269,7 +5272,6 @@ Business Template is a set of definitions, such as skins, portal types and categ
if not force: if not force:
self.checkDependencies() self.checkDependencies()
site = self.getPortalObject()
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5.ERP5Site import ERP5Generator
generator_class = getattr(site, '_generator_class', ERP5Generator) generator_class = getattr(site, '_generator_class', ERP5Generator)
gen = generator_class() gen = generator_class()
......
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