Commit 7f3408f1 authored by Christophe Dumez's avatar Christophe Dumez

Added a script that return the id of the original business template where the...

Added a script that return the id of the original business template where the given object is coming from.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7295 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f72c83fd
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<value> <string>installed_bts = context.getPortalObject()[\'portal_templates\'].getInstalledBusinessTemplatesList()\n <value> <string>installed_bts = context.getPortalObject()[\'portal_templates\'].getInstalledBusinessTemplatesList()\n
for bt in installed_bts:\n for bt in installed_bts:\n
if file in bt.getItemsList():\n if file in bt.getItemsList():\n
return [bt.getTitle(), bt.getId()]\n return bt.getId()\n
return None\n return None\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -356,6 +356,9 @@ class BaseTemplateItem(Implicit, Persistent): ...@@ -356,6 +356,9 @@ class BaseTemplateItem(Implicit, Persistent):
def export(self, context, bta, **kw): def export(self, context, bta, **kw):
pass pass
def getKeys(self):
return self._objects.keys()
def importFile(self, bta, **kw): def importFile(self, bta, **kw):
bta.importFiles(klass=self) bta.importFiles(klass=self)
...@@ -4278,6 +4281,15 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4278,6 +4281,15 @@ Business Template is a set of definitions, such as skins, portal types and categ
for item_name in self._item_name_list: for item_name in self._item_name_list:
getattr(self, item_name).importFile(bta) getattr(self, item_name).importFile(bta)
#By christophe Dumez <christophe@nexedi.com>
def getItemsList(self):
"""Return list of items in business template
"""
items_list = []
for item_name in self._item_name_list:
item = getattr(self, item_name)
items_list.extend(item.getKeys())
return items_list
def diffObject(self, REQUEST, **kw): def diffObject(self, REQUEST, **kw):
""" """
......
...@@ -103,6 +103,15 @@ class TemplateTool (BaseTool): ...@@ -103,6 +103,15 @@ class TemplateTool (BaseTool):
return bt return bt
return None return None
def getInstalledBusinessTemplatesList(self):
"""Get list of installed business templates
"""
installed_bts = []
for bt in self.contentValues(filter={'portal_type':'Business Template'}):
if bt.getInstallationState() == 'installed':
installed_bts.append(bt)
return installed_bts
def updateLocalConfiguration(self, template, **kw): def updateLocalConfiguration(self, template, **kw):
""" """
Call the update method on the configuration, create if it doesn't Call the update method on the configuration, create if it doesn't
......
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