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
No related merge requests found
......@@ -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
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 = []
dependency_list = self.getDependencyList()
if len(dependency_list)!=0:
if len(dependency_list) > 0:
for dependency_couple in dependency_list:
dependency_couple_list = dependency_couple.strip().split(' ', 1)
dependency = dependency_couple_list[0]
......@@ -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
(not self.portal_templates.compareVersionStrings(installed_bt.getVersion(), version_restriction)))):
missing_dep_list.append((dependency, version_restriction or ''))
if len(missing_dep_list) != 0:
raise BusinessTemplateMissingDependency, 'Impossible to install, please install the following dependencies before: %s'%repr(missing_dep_list)
return [' '.join([y for y in x if y]) for x in missing_dep_list]
def diffObjectAsHTML(self, REQUEST, **kw):
"""
......
......@@ -74,7 +74,6 @@ from zLOG import LOG, DEBUG
from Products.ERP5Type.tests.backportUnittest import SetupSiteError
from Products.ERP5Type.tests.utils import DummyMailHostMixin, parseListeningAddress
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateMissingDependency
# Quiet messages when installing products
install_product_quiet = 1
......@@ -897,10 +896,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start))
# For unit test, we accept installing business templates with
# missing a part of dependencies.
try:
bt.checkDependencies()
except BusinessTemplateMissingDependency:
ZopeTestCase._print('(some dependencies are missing) ')
missing_dep_list = bt.getMissingDependencyList()
if len(missing_dep_list) > 0:
ZopeTestCase._print('(missing dependencies : %r) ' % missing_dep_list)
install_kw = None
if get_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