@@ -17,7 +17,6 @@ class SDBaseValidator(object):
17
17
__metaclass__ = abc .ABCMeta
18
18
19
19
def check_dictionary_value (self , dictionary_value ):
20
- print dictionary_value
21
20
if isinstance (dictionary_value , dict ):
22
21
self .check_dictionary (dictionary_value )
23
22
elif isinstance (dictionary_value , list ):
@@ -28,12 +27,20 @@ def check_dictionary_value(self, dictionary_value):
28
27
"This query has invalid keys or values." )
29
28
30
29
def check_dictionary (self , dictionary ):
30
+ if not dictionary :
31
+ raise exceptions .InvalidQueryException (
32
+ "This query has invalid keys or values." )
33
+
31
34
for key in dictionary :
32
35
dictionary_value = dictionary [key ]
33
36
self .check_dictionary_value (dictionary_value )
34
37
35
- def check_list (self , dictionary ):
36
- for dictionary_value in dictionary :
38
+ def check_list (self , dictionary_list ):
39
+ if not dictionary_list :
40
+ raise exceptions .InvalidQueryException (
41
+ "This query has invalid keys or values." )
42
+
43
+ for dictionary_value in dictionary_list :
37
44
self .check_dictionary_value (dictionary_value )
38
45
39
46
def __init__ (self , dictionary ):
0 commit comments