Revision 67620dff lib/qlang.py
b/lib/qlang.py  

32  32 
""" 
33  33  
34  34 
import re 
35 
import string # pylint: disable=W0402 

36  35 
import logging 
37  36  
38  37 
import pyparsing as pyp 
39  38  
39 
from ganeti import constants 

40  40 
from ganeti import errors 
41  41 
from ganeti import utils 
42  42 
from ganeti import compat 
43  43  
44  44  
45 
# Logic operators with one or more operands, each of which is a filter on its 

46 
# own 

47 
OP_OR = "" 

48 
OP_AND = "&" 

49  
50  
51 
# Unary operators with exactly one operand 

52 
OP_NOT = "!" 

53 
OP_TRUE = "?" 

54  
55  
56 
# Binary operators with exactly two operands, the field name and an 

57 
# operatorspecific value 

58 
OP_EQUAL = "=" 

59 
OP_NOT_EQUAL = "!=" 

60 
OP_LT = "<" 

61 
OP_LE = "<=" 

62 
OP_GT = ">" 

63 
OP_GE = ">=" 

64 
OP_REGEXP = "=~" 

65 
OP_CONTAINS = "=[]" 

66  
67  
68 
#: Characters used for detecting userwritten filters (see L{_CheckFilter}) 

69 
FILTER_DETECTION_CHARS = frozenset("()=/!~'\"\\<>" + string.whitespace) 

70  
71 
#: Characters used to detect globbing filters (see L{_CheckGlobbing}) 

72 
GLOB_DETECTION_CHARS = frozenset("*?") 

45 
OP_OR = constants.QLANG_OP_OR 

46 
OP_AND = constants.QLANG_OP_AND 

47 
OP_NOT = constants.QLANG_OP_NOT 

48 
OP_TRUE = constants.QLANG_OP_TRUE 

49 
OP_EQUAL = constants.QLANG_OP_EQUAL 

50 
OP_NOT_EQUAL = constants.QLANG_OP_NOT_EQUAL 

51 
OP_LT = constants.QLANG_OP_LT 

52 
OP_LE = constants.QLANG_OP_LE 

53 
OP_GT = constants.QLANG_OP_GT 

54 
OP_GE = constants.QLANG_OP_GE 

55 
OP_REGEXP = constants.QLANG_OP_REGEXP 

56 
OP_CONTAINS = constants.QLANG_OP_CONTAINS 

57 
FILTER_DETECTION_CHARS = constants.QLANG_FILTER_DETECTION_CHARS 

58 
GLOB_DETECTION_CHARS = constants.QLANG_GLOB_DETECTION_CHARS 

73  59  
74  60  
75  61 
def MakeSimpleFilter(namefield, values): 
Also available in: Unified diff