diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 3db5c9c466341480dd44ed3c0b5de67dcda6ef38..84275cc75cfa5d90fe133698c400ab3d54f67f15 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -66,6 +66,7 @@ from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules from Products.ERP5Type.Core.PropertySheet import PropertySheet as PropertySheetDocument from Products.ERP5Type.TransactionalVariable import getTransactionalVariable +from Products.ERP5.Document.File import File from OFS.Traversable import NotFound from OFS import SimpleItem, XMLExportImport from OFS.Image import Pdata @@ -617,6 +618,8 @@ class BaseTemplateItem(Implicit, Persistent): for attr in 'errors', 'warnings', '_proxy_roles': if not obj.__dict__.get(attr, 1): delattr(obj, attr) + elif classname in ('File', 'Image'): + attr_set.update(('_EtagSupport__etag', 'size')) elif classname == 'SQL' and klass.__module__== 'Products.ZSQLMethods.SQL': attr_set.update(('_arg', 'template')) elif interfaces.IIdGenerator.providedBy(obj): @@ -1462,6 +1465,9 @@ class ObjectTemplateItem(BaseTemplateItem): assert container.meta_type in ('ERP5 Cache Factory', 'ERP5 Cache Bag') container.getParentValue().updateCache() + elif obj.__class__.__name__ in ('File', 'Image'): + if "data" in obj.__dict__: + File._setData.__func__(obj, obj.data) elif (container.meta_type == 'CMF Skins Tool') and \ (old_obj is not None): # Keep compatibility with previous export format of diff --git a/product/ERP5/tests/testTemplateTool.py b/product/ERP5/tests/testTemplateTool.py index cf6a4ae22a26fe2601472bbf971d8da980358f83..bf10050ad56bad102d86edc404e1e2b52cf4b82a 100644 --- a/product/ERP5/tests/testTemplateTool.py +++ b/product/ERP5/tests/testTemplateTool.py @@ -363,6 +363,7 @@ class TestTemplateTool(ERP5TypeTestCase): # We don't export revision anymore. self.assertFalse(os.path.exists(os.path.join(root, 'bt', 'revision'))) # Computed at download ... + revision = '+Kds1k1J41hzO4yIO+GcKQukNps=' self.assertEqual(revision, template_tool.download(root).getRevision()) finally: shutil.rmtree(root) @@ -370,14 +371,14 @@ class TestTemplateTool(ERP5TypeTestCase): # ... at building by default ... bt.build() revision = bt.getRevision() - self.assertEqual('9rVhiz7Agr5G7L1jegm9yLuUD9U=', revision) + self.assertEqual('xR/n0PtLoc+1CR0AyJ+xGjbxsjE=', revision) self.portal.portal_skins.erp5_test.manage_renameObject('test_file', 'test_file2') bt.build(update_revision=False) self.assertEqual(revision, bt.getRevision()) # ... and at export. bt.export(str(random.random())) - self.assertEqual('dhgvzCfmibJEiy5M+5axf9ZM3gA=', bt.getRevision()) + self.assertEqual('fnLZVdsjkNDoC0JWstMY2XL1x+s=', bt.getRevision()) self.abort() def test_getInstalledBusinessTemplateList(self):