Commit 9cfc4f66 authored by Douglas's avatar Douglas

pivottablejs: removed erp5_url parameter in favor of REQUEST headers

This is the proper way to refer to the URL on which ERP5 is being served.
parent e47f5607
......@@ -397,7 +397,7 @@ class ProcessorList(object):
return self.processors.get(something.__class__, self.default_processor)
else:
return self.processors.get(something.__name__, self.default_processor)
def storeIFrame(self, html, key):
self.portal_caches.erp5_pivottable_frame_cache.set(key, html)
......@@ -408,7 +408,7 @@ def storeIFrame(self, html, key):
# This is a highly experimental PivotTableJs integration which does not follow
# ERP5 Javascrpt standards and it will be refactored to use JIO and RenderJS.
#
def erp5PivotTableUI(self, df, erp5_url):
def erp5PivotTableUI(self, df):
from IPython.display import IFrame
template = """
<!DOCTYPE html>
......@@ -477,5 +477,6 @@ def erp5PivotTableUI(self, df, erp5_url):
from hashlib import sha512
key = sha512(html_string).hexdigest()
storeIFrame(self, html_string, key)
url = "%s/Base_displayPivotTableFrame?key=%s" % (erp5_url, key)
iframe_host = self.REQUEST['HTTP_X_FORWARDED_HOST'].split(',')[0]
url = "https://%s/erp5/Base_displayPivotTableFrame?key=%s" % (iframe_host, key)
return IFrame(src=url, width='100%', height='500')
......@@ -452,7 +452,7 @@ class DataFrameMock(object):
return "column1, column2; 1, 2;"
my_df = DataFrameMock()
iframe = context.Base_erp5PivotTableUI(my_df, 'https://localhost:2202/erp5')
iframe = context.Base_erp5PivotTableUI(my_df)
context.Base_renderAsHtml(iframe)
'''
reference = 'Test.Notebook.PivotTableJsIntegration %s' % time.time()
......@@ -467,3 +467,4 @@ context.Base_renderAsHtml(iframe)
# of the pivot table page's html.
pivottable_frame_display_path = 'Base_displayPivotTableFrame?key=853524757258b19805d13beb8c6bd284a7af4a974a96a3e5a4847885df069a74d3c8c1843f2bcc4d4bb3c7089194b57c90c14fe8dd0c776d84ce0868e19ac411'
self.assertTrue(pivottable_frame_display_path in json_result['code_result'])
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