Commit 04ac2b75 authored by Rafael Monnerat's avatar Rafael Monnerat

Prevent raise if business template is not installed

If Business Template is not present, returns None.
parent 00429f2b
...@@ -172,7 +172,9 @@ class TemplateTool (BaseTool): ...@@ -172,7 +172,9 @@ class TemplateTool (BaseTool):
given given
""" """
bt = self.getInstalledBusinessTemplate(title) bt = self.getInstalledBusinessTemplate(title)
if bt is not None:
return bt.getRevision() return bt.getRevision()
return None
def getBuiltBusinessTemplatesList(self): def getBuiltBusinessTemplatesList(self):
"""Deprecated. """Deprecated.
......
...@@ -281,6 +281,9 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -281,6 +281,9 @@ class TestTemplateTool(ERP5TypeTestCase):
self.assertTrue(300 < self.getPortal()\ self.assertTrue(300 < self.getPortal()\
.portal_templates.getInstalledBusinessTemplateRevision('erp5_core')) .portal_templates.getInstalledBusinessTemplateRevision('erp5_core'))
self.assertEquals(None, self.getPortal()\
.portal_templates.getInstalledBusinessTemplateRevision('erp5_toto'))
def test_getInstalledBusinessTemplateList(self): def test_getInstalledBusinessTemplateList(self):
templates_tool = self.getPortal().portal_templates templates_tool = self.getPortal().portal_templates
bt5_list = templates_tool.getInstalledBusinessTemplateList() bt5_list = templates_tool.getInstalledBusinessTemplateList()
......
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