Commit 2abd0e97 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Remove factory_type_information, because it is now handled by ERP5 Core. Add...

Remove factory_type_information, because it is now handled by ERP5 Core. Add getInstalledBusinessTemplate to find an older installed business template. Do not build a business template automatically when exporting.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1826 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5cd3ff4
......@@ -80,38 +80,18 @@ class TemplateTool (BaseTool):
security.declareProtected( Permissions.ManagePortal, 'manage_overview' )
manage_overview = DTMLFile( 'explainRuleTool', _dtmldir )
# Factory Type Information
factory_type_information = \
{ 'id' : portal_type
, 'meta_type' : meta_type
, 'description' : """\
TemplateTool manages Business Templates."""
, 'icon' : 'folder_icon.gif'
, 'product' : 'ERP5Type'
, 'factory' : 'addFolder'
, 'immediate_view' : 'Folder_viewContentList'
, 'allow_discussion' : 1
, 'allowed_content_types': ('Business Template',
)
, 'filter_content_types' : 1
, 'global_allow' : 1
, 'actions' :
( { 'id' : 'view'
, 'name' : 'View'
, 'category' : 'object_view'
, 'action' : 'Folder_viewContentList'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'search'
, 'name' : 'Search'
, 'category' : 'object_search'
, 'action' : 'BusinessTemplate_search'
, 'permissions' : (
Permissions.View, )
}
)
}
def getInstalledBusinessTemplate(self, title, **kw):
"""
Return a installed business template if any.
"""
# This can be slow if, say, 10000 business templates are present.
# However, that unlikely happens, and using a Z SQL Method has a potential danger
# because business templates may exchange catalog methods, so the database could be
# broken temporarily.
for bt in self.contentValues(filter={'portal_type':'Business Template'}):
if bt.getInstallationState() == 'installed' and bt.getTitle() == title:
return bt
return None
# Import a business template
def importURL(self, url):
......@@ -141,7 +121,7 @@ TemplateTool manages Business Templates."""
"""
Save in a format or another
"""
business_template.build()
#business_template.build()
self.manage_exportObject(id=business_template.getId(), toxml=toxml)
suffix = toxml and 'xml' or 'zexp'
cfg = getConfiguration()
......@@ -179,6 +159,7 @@ TemplateTool manages Business Templates."""
self._importObjectFromFile(file, id=id)
bt = self[id]
bt.id = id # Make sure id is consistent
#LOG('Template Tool', 0, 'Indexing %r, isIndexable = %r' % (bt, bt.isIndexable))
bt.immediateReindexObject()
if REQUEST is not None:
......
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