Commit a29590a1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

put uploaded data itself instead of temporary persistent object in erp5_ooo_import.

so that we can use Distributed Ram Cache as the backend of the session cache.
parent 7cd0fcac
......@@ -50,8 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempFile\n
from Products.ERP5OOo.OOoUtils import OOoParser\n
<value> <string>from Products.ERP5OOo.OOoUtils import OOoParser\n
import string\n
\n
request = container.REQUEST\n
......@@ -103,8 +102,7 @@ if len(listbox) == 0:\n
# Start a session and store the content of the file\n
session_id = context.browser_id_manager.getBrowserId(create=1)\n
session = context.portal_sessions[session_id]\n
temp_file = newTempFile(context, session_id)\n
temp_file.edit(spreadsheet_mapping=spreadsheets)\n
temp_file = dict(spreadsheet_mapping=spreadsheets)\n
\n
#create a temporary file_name\n
timestamp = "%s" % DateTime.timeTime(DateTime())\n
......@@ -132,7 +130,7 @@ else:\n
temp_file = session[temp_file_name]\n
# Clear this session after import is done\n
session[temp_file_name] = None\n
spreadsheets = temp_file.getProperty(\'spreadsheet_mapping\')\n
spreadsheets = temp_file[\'spreadsheet_mapping\']\n
\n
# Build the data mapping\n
mapping = {}\n
......
412
\ No newline at end of file
413
\ No newline at end of file
......@@ -71,6 +71,17 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
'erp5_web_ui_test',
)
def afterSetUp(self):
super(TestZeleniumCore, self).afterSetUp()
# erp5_ooo_import puts (temporary) persistent object into cache,
# that is not possible with Distributed Ram Cache.
portal_caches = self.portal.portal_caches
session_cache_factory = portal_caches[SESSION_CACHE_FACTORY]
for i in session_cache_factory.objectValues(portal_type='Distributed Ram Cache'):
session_cache_factory.manage_delObjects(ids=[i.getId(),])
self.commit()
portal_caches.updateCache()
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestZeleniumCore))
......
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