소스 검색

Improve error if db is wrongly passed

Oz N Tiram 6 년 전
부모
커밋
eb229364cc
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      pwman/data/factory.py

+ 5 - 0
pwman/data/factory.py

@@ -62,6 +62,11 @@ def check_db_version(dburi):
 
     dburi = urlparse(dburi)
     dbtype = dburi.scheme
+
+    if not dbtype:
+        print("Your URI seems incorrect ...")
+        sys.exit(0)
+
     try:
         cls = getattr(drivers, class_db_map[dbtype][0])
         ver = cls.check_db_version(class_db_map[dbtype][1](dburi))