Commit eaf027b2 authored by Julien Muchembled's avatar Julien Muchembled

BT: remove _EtagSupport__etag/size properties when exporting Files/Images

parent d7acbf30
......@@ -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
......
......@@ -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):
......
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