浏览代码

fix: `clear()` bug

wangweimin 4 年之前
父节点
当前提交
d121476080
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      pywebio/output.py

+ 3 - 2
pywebio/output.py

@@ -146,8 +146,9 @@ def clear(scope=Scope.Current):
 
     :param int/str scope: 可以直接指定scope名或使用 `Scope` 常量
     """
-    scope_name = get_current_session().get_scope_name(scope)
-    send_msg('output_ctl', dict(clear=_parse_scope(scope_name)))
+    if isinstance(scope, int):
+        scope = get_current_session().get_scope_name(scope)
+    send_msg('output_ctl', dict(clear=_parse_scope(scope)))
 
 
 def remove(scope):