(list_or_dict,json_key)
| 55 | sys.exit(1) |
| 56 | |
| 57 | def validateConfigREs(list_or_dict,json_key): |
| 58 | have_error = False |
| 59 | for item in list_or_dict: |
| 60 | try: |
| 61 | re.compile(item) |
| 62 | except re.error as err: |
| 63 | configError("item '%s' of '%s' is not a valid regular expression: %s"%(item,json_key,err),fatal=False) |
| 64 | have_error = True |
| 65 | continue |
| 66 | if not isinstance(list_or_dict,dict): |
| 67 | continue |
| 68 | # item is actually a dict key; check value |
| 69 | value = list_or_dict[item] |
| 70 | if (not isinstance(value,list) or len(value) != 2 |
| 71 | or not isinstance(value[0],bool) or not isinstance(value[1],str)): |
| 72 | configError("item '%s' of '%s' must be an array [bool,string]"%(item,json_key),fatal=False) |
| 73 | have_error = True |
| 74 | |
| 75 | return have_error |
| 76 | |
| 77 | def loadConfig(configfile): |
| 78 | if not os.path.exists(configfile): |
no test coverage detected