Browse Source

fix: `clear()` bug

wangweimin 4 years ago
parent
commit
d121476080
1 changed files with 3 additions and 2 deletions
  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` 常量
     :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):
 def remove(scope):