Ver Fonte

fix bokeh support

wangweimin há 4 anos atrás
pai
commit
a8e4a4fafc
2 ficheiros alterados com 6 adições e 11 exclusões
  1. 1 6
      pywebio/output.py
  2. 5 5
      pywebio/platform/bokeh.py

+ 1 - 6
pywebio/output.py

@@ -143,7 +143,7 @@ __all__ = ['Position', 'remove', 'scroll_to',
            'put_text', 'put_html', 'put_code', 'put_markdown', 'use_scope', 'set_scope', 'clear', 'remove',
            'put_table', 'put_buttons', 'put_image', 'put_file', 'PopupSize', 'popup',
            'close_popup', 'put_widget', 'put_collapse', 'put_link', 'put_scrollable', 'style', 'put_column',
-           'put_row', 'put_grid', 'column', 'row', 'grid', 'span', 'put_processbar', 'set_processbar', 'put_loading',
+           'put_row', 'put_grid', 'span', 'put_processbar', 'set_processbar', 'put_loading',
            'output', 'toast', 'get_scope']
 
 
@@ -1108,11 +1108,6 @@ def put_grid(content, cell_width='auto', cell_height='auto', cell_widths=None, c
     return put_widget(template=tpl, data=dict(contents=content), scope=scope, position=position)
 
 
-column = put_column
-row = put_row
-grid = put_grid
-
-
 @safely_destruct_output_when_exp('contents')
 def output(*contents):
     """返回一个handler,相当于 ``put_xxx()`` 的占位符,可以传入任何接收 ``put_xxx()`` 调用的地方,通过handler可对自身内容进行修改

+ 5 - 5
pywebio/platform/bokeh.py

@@ -43,11 +43,11 @@ def load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout
         js_gists.append('Bokeh.set_log_level("info");')
         js_gists.append("console.log('Set bokeh log level to INFO because you set `output_notebook(verbose=True)`')")
 
-    put_html(requirejs_tpl % (html, '\n'.join(js_gists)))
+    put_html(requirejs_tpl % (html, '\n'.join(js_gists)), sanitize=False)
 
 
 def show_doc(obj, state, notebook_handle):
-    """显示 Bokeh 单个 documents
+    """Show a document of Bokeh
 
     :param obj:
     :param state:
@@ -62,11 +62,11 @@ def show_doc(obj, state, notebook_handle):
     elif isinstance(obj, dict):
         div = '\n'.join(div[k] for k in obj.keys())
 
-    put_html(requirejs_tpl % (div, script))
+    put_html(requirejs_tpl % (div, script), sanitize=False)
 
 
 def show_app(app, state, notebook_url, port=0, **kw):
-    """显示 Bokeh applications
+    """Show Bokeh applications
 
     :param app: A Bokeh Application to embed in PyWebIO.
     :param state: ** Unused **
@@ -110,7 +110,7 @@ def show_app(app, state, notebook_url, port=0, **kw):
     </script>
     """, script)
 
-    put_html(script)
+    put_html(script, sanitize=False)
 
 
 def try_install_bokeh_hook():