Commit 0ad342c4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

display a more useful message in case of missing dependencies.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43437 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent abfc2bfe
...@@ -5230,9 +5230,17 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5230,9 +5230,17 @@ Business Template is a set of definitions, such as skins, portal types and categ
are installed. Raise an exception with the list of are installed. Raise an exception with the list of
missing dependencies if some are missing missing dependencies if some are missing
""" """
missing_dep_list = self.getMissingDependencyList()
if len(missing_dep_list) != 0:
raise BusinessTemplateMissingDependency, 'Impossible to install, please install the following dependencies before: %s'%repr(missing_dep_list)
def getMissingDependencyList(self):
"""
Retuns a list of missing dependencies.
"""
missing_dep_list = [] missing_dep_list = []
dependency_list = self.getDependencyList() dependency_list = self.getDependencyList()
if len(dependency_list)!=0: if len(dependency_list) > 0:
for dependency_couple in dependency_list: for dependency_couple in dependency_list:
dependency_couple_list = dependency_couple.strip().split(' ', 1) dependency_couple_list = dependency_couple.strip().split(' ', 1)
dependency = dependency_couple_list[0] dependency = dependency_couple_list[0]
...@@ -5250,8 +5258,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5250,8 +5258,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
or (version_restriction not in (None, '') and or (version_restriction not in (None, '') and
(not self.portal_templates.compareVersionStrings(installed_bt.getVersion(), version_restriction)))): (not self.portal_templates.compareVersionStrings(installed_bt.getVersion(), version_restriction)))):
missing_dep_list.append((dependency, version_restriction or '')) missing_dep_list.append((dependency, version_restriction or ''))
if len(missing_dep_list) != 0: return [' '.join([y for y in x if y]) for x in missing_dep_list]
raise BusinessTemplateMissingDependency, 'Impossible to install, please install the following dependencies before: %s'%repr(missing_dep_list)
def diffObjectAsHTML(self, REQUEST, **kw): def diffObjectAsHTML(self, REQUEST, **kw):
""" """
......
...@@ -74,7 +74,6 @@ from zLOG import LOG, DEBUG ...@@ -74,7 +74,6 @@ from zLOG import LOG, DEBUG
from Products.ERP5Type.tests.backportUnittest import SetupSiteError from Products.ERP5Type.tests.backportUnittest import SetupSiteError
from Products.ERP5Type.tests.utils import DummyMailHostMixin, parseListeningAddress from Products.ERP5Type.tests.utils import DummyMailHostMixin, parseListeningAddress
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateMissingDependency
# Quiet messages when installing products # Quiet messages when installing products
install_product_quiet = 1 install_product_quiet = 1
...@@ -897,10 +896,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -897,10 +896,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start)) ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start))
# For unit test, we accept installing business templates with # For unit test, we accept installing business templates with
# missing a part of dependencies. # missing a part of dependencies.
try: missing_dep_list = bt.getMissingDependencyList()
bt.checkDependencies() if len(missing_dep_list) > 0:
except BusinessTemplateMissingDependency: ZopeTestCase._print('(missing dependencies : %r) ' % missing_dep_list)
ZopeTestCase._print('(some dependencies are missing) ')
install_kw = None install_kw = None
if get_install_kw: if get_install_kw:
install_kw = {} install_kw = {}
......
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