Commit 959ba78d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

WIP: py2/py3: BusinessTemplate.py.

parent b604f760
...@@ -93,6 +93,10 @@ from difflib import unified_diff ...@@ -93,6 +93,10 @@ from difflib import unified_diff
import posixpath import posixpath
import transaction import transaction
import inspect import inspect
if six.PY2:
BufferedReader = file
else:
from io import BufferedReader
import threading import threading
from ZODB.broken import Broken, BrokenModified from ZODB.broken import Broken, BrokenModified
...@@ -918,7 +922,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -918,7 +922,7 @@ class ObjectTemplateItem(BaseTemplateItem):
else: else:
connection = self.getConnection(self.aq_parent) connection = self.getConnection(self.aq_parent)
__traceback_info__ = 'Importing %s' % file_name __traceback_info__ = 'Importing %s' % file_name
if hasattr(cache_database, 'db') and isinstance(file_obj, file): if hasattr(cache_database, 'db') and isinstance(file_obj, BufferedReader):
obj = connection.importFile(self._compileXML(file_obj)) obj = connection.importFile(self._compileXML(file_obj))
else: else:
# FIXME: Why not use the importXML function directly? Are there any BT5s # FIXME: Why not use the importXML function directly? Are there any BT5s
......
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