Commit 37ae4006 authored by Nicolas Delaby's avatar Nicolas Delaby

Extend installBusinessTemplatesFromRepositories with new update_catalog parameter.

It allow to disable the clearing catalog when installing business template.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36072 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f51bc452
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -61,6 +62,8 @@ import subprocess ...@@ -61,6 +62,8 @@ import subprocess
WIN = os.name == 'nt' WIN = os.name == 'nt'
_MARKER = []
class BusinessTemplateUnknownError(Exception): class BusinessTemplateUnknownError(Exception):
""" Exception raised when the business template """ Exception raised when the business template
is impossible to find in the repositories is impossible to find in the repositories
...@@ -1042,7 +1045,7 @@ class TemplateTool (BaseTool): ...@@ -1042,7 +1045,7 @@ class TemplateTool (BaseTool):
security.declareProtected(Permissions.ManagePortal, security.declareProtected(Permissions.ManagePortal,
'installBusinessTemplatesFromRepositories' ) 'installBusinessTemplatesFromRepositories' )
def installBusinessTemplatesFromRepositories(self, template_list, def installBusinessTemplatesFromRepositories(self, template_list,
only_newer=True): only_newer=True, update_catalog=_MARKER):
"""Installs template_list from configured repositories by default only newest""" """Installs template_list from configured repositories by default only newest"""
# XXX-Luke: This method could replace # XXX-Luke: This method could replace
# TemplateTool_installRepositoryBusinessTemplateList while still being # TemplateTool_installRepositoryBusinessTemplateList while still being
...@@ -1057,7 +1060,10 @@ class TemplateTool (BaseTool): ...@@ -1057,7 +1060,10 @@ class TemplateTool (BaseTool):
template_name]['revision']: template_name]['revision']:
template_document = self.download(template_dict[template_name][ template_document = self.download(template_dict[template_name][
'url']) 'url'])
template_document.install() if update_catalog is _MARKER:
template_document.install()
else:
template_document.install(update_catalog=update_catalog)
opreation_log.append('Installed %s with revision %s' % ( opreation_log.append('Installed %s with revision %s' % (
template_document.getTitle(), template_document.getRevision())) template_document.getTitle(), template_document.getRevision()))
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