Commit a48af0e2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

Revert "WIP: py2/py3: store file content as it is in Business Template for PathTemplateItem."

This reverts commit 45ce6a213d488b250ecabc0f41afd89cfb629a7d.
parent 06a44d25
...@@ -940,7 +940,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -940,7 +940,7 @@ class ObjectTemplateItem(BaseTemplateItem):
# ObjectTemplateItem.__init__() # ObjectTemplateItem.__init__()
# XXX - the above comment is a bit unclear, # XXX - the above comment is a bit unclear,
# still not sure if this is handled correctly # still not sure if this is handled correctly
if obj_key.split(os.path.sep, 1)[0] == 'portal_components': if file_obj.name.rsplit(os.path.sep, 2)[-2] == 'portal_components':
self._archive[obj_key] = None self._archive[obj_key] = None
try: try:
del self._archive[obj_key[len('portal_components/'):]] del self._archive[obj_key[len('portal_components/'):]]
...@@ -1678,7 +1678,6 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1678,7 +1678,6 @@ class PathTemplateItem(ObjectTemplateItem):
id_list = ensure_list(self._archive.keys()) id_list = ensure_list(self._archive.keys())
self._archive.clear() self._archive.clear()
self._path_archive = PersistentMapping() self._path_archive = PersistentMapping()
self._files = PersistentMapping()
for id in id_list: for id in id_list:
self._path_archive[id] = None self._path_archive[id] = None
...@@ -1770,8 +1769,6 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1770,8 +1769,6 @@ class PathTemplateItem(ObjectTemplateItem):
obj.wl_clearLocks() obj.wl_clearLocks()
def install(self, context, *args, **kw): def install(self, context, *args, **kw):
for file_name, data in six.iteritems(self._files):
super(PathTemplateItem, self)._importFile(file_name, BytesIO(data))
super(PathTemplateItem, self).install(context, *args, **kw) super(PathTemplateItem, self).install(context, *args, **kw)
# Regenerate local roles for all paths in this business template # Regenerate local roles for all paths in this business template
...@@ -1811,9 +1808,6 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1811,9 +1808,6 @@ class PathTemplateItem(ObjectTemplateItem):
% (portal_type, obj.getRelativeUrl())) % (portal_type, obj.getRelativeUrl()))
transaction.get().addBeforeCommitHook(updateLocalRolesOnDocument) transaction.get().addBeforeCommitHook(updateLocalRolesOnDocument)
def _importFile(self, file_name, file_obj):
self._files[file_name] = file_obj.read()
class ToolTemplateItem(PathTemplateItem): class ToolTemplateItem(PathTemplateItem):
"""This class is used only for making a distinction between other objects """This class is used only for making a distinction between other objects
and tools, because tools may not be backed up. and tools, because tools may not be backed up.
......
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