diff --git a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py index 95970f6e69a006839cc5509d14b70a56f580cbf1..21625a1edf870cc2a5340b2f7732393e20c5049f 100644 --- a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py +++ b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py @@ -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') diff --git a/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py b/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py index 401094847ca04f4c8b92533f60a0ef6c7adc1dee..fffb6bae0aff1849e05d7cbeca83a5ee3619d03d 100644 --- a/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py +++ b/bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py @@ -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']) +