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 @@ ...@@ -50,8 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempFile\n <value> <string>from Products.ERP5OOo.OOoUtils import OOoParser\n
from Products.ERP5OOo.OOoUtils import OOoParser\n
import string\n import string\n
\n \n
request = container.REQUEST\n request = container.REQUEST\n
...@@ -103,8 +102,7 @@ if len(listbox) == 0:\n ...@@ -103,8 +102,7 @@ if len(listbox) == 0:\n
# Start a session and store the content of the file\n # Start a session and store the content of the file\n
session_id = context.browser_id_manager.getBrowserId(create=1)\n session_id = context.browser_id_manager.getBrowserId(create=1)\n
session = context.portal_sessions[session_id]\n session = context.portal_sessions[session_id]\n
temp_file = newTempFile(context, session_id)\n temp_file = dict(spreadsheet_mapping=spreadsheets)\n
temp_file.edit(spreadsheet_mapping=spreadsheets)\n
\n \n
#create a temporary file_name\n #create a temporary file_name\n
timestamp = "%s" % DateTime.timeTime(DateTime())\n timestamp = "%s" % DateTime.timeTime(DateTime())\n
...@@ -132,7 +130,7 @@ else:\n ...@@ -132,7 +130,7 @@ else:\n
temp_file = session[temp_file_name]\n temp_file = session[temp_file_name]\n
# Clear this session after import is done\n # Clear this session after import is done\n
session[temp_file_name] = None\n session[temp_file_name] = None\n
spreadsheets = temp_file.getProperty(\'spreadsheet_mapping\')\n spreadsheets = temp_file[\'spreadsheet_mapping\']\n
\n \n
# Build the data mapping\n # Build the data mapping\n
mapping = {}\n mapping = {}\n
......
412 413
\ No newline at end of file \ No newline at end of file
...@@ -71,6 +71,17 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase): ...@@ -71,6 +71,17 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
'erp5_web_ui_test', '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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestZeleniumCore)) 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