Browse Source

print error if https rewrite directory is not found, #116

Thomas Pointhuber 10 years ago
parent
commit
6ecf03c736
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      searx/https_rewrite.py

+ 5
- 4
searx/https_rewrite.py View File

18
 import re
18
 import re
19
 from lxml import etree
19
 from lxml import etree
20
 from os import listdir
20
 from os import listdir
21
-from os.path import isfile, join
21
+from os.path import isfile, isdir, join
22
 
22
 
23
 
23
 
24
 # https://gitweb.torproject.org/\
24
 # https://gitweb.torproject.org/\
120
 
120
 
121
 # load all https rewrite rules
121
 # load all https rewrite rules
122
 def load_https_rules(rules_path):
122
 def load_https_rules(rules_path):
123
-    # add / to path if not set yet
124
-    if rules_path[-1:] != '/':
125
-        rules_path += '/'
123
+    # check if directory exists
124
+    if not isdir(rules_path):
125
+        print("[E] directory not found: '" + rules_path + "'")
126
+        return
126
 
127
 
127
     # search all xml files which are stored in the https rule directory
128
     # search all xml files which are stored in the https rule directory
128
     xml_files = [join(rules_path, f)
129
     xml_files = [join(rules_path, f)