yuxiaoyuan0406 commited on
Commit
7dd73e1
1 Parent(s): 4cfbacd

添加了一个检查path的工具

Browse files
Files changed (1) hide show
  1. toolbox.py +19 -0
toolbox.py CHANGED
@@ -527,3 +527,22 @@ class DummyWith():
527
 
528
  def __exit__(self, exc_type, exc_value, traceback):
529
  return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
 
528
  def __exit__(self, exc_type, exc_value, traceback):
529
  return
530
+
531
+ def custom_path_check(path: str)->bool:
532
+ '''
533
+ check path for sub url
534
+
535
+ path: path to check
536
+
537
+ return value: do sub url wrap
538
+ '''
539
+ if len(path) == 0:
540
+ print("ilegal custom path: {}\npath must not be empty\ndeploy on root url".format(path))
541
+ return False
542
+ if path[0] == '/':
543
+ if path[1] != '/':
544
+ print("deploy on sub-path {}".format(path))
545
+ return True
546
+ return False
547
+ print("ilegal custom path: {}\npath should begin with \'/\'\ndeploy on root url".format(path))
548
+ return False