def _ShouldLoad(module_file, is_global): """Checks if a module is safe to be loaded. By default this will try to decide using a white-/blacklist and ask the user for confirmation as a fallback.""" if is_global or not user_options_store.Value('confirm_extra_conf'): return True globlist = user_options_store.Value('extra_conf_globlist') for glob in globlist: is_blacklisted = glob[0] == '!' if _MatchesGlobPattern(module_file, glob.lstrip('!')): return not is_blacklisted raise UnknownExtraConf(module_file)
def UnknownExtraConfResponse( *args ): raise UnknownExtraConf( FILE_NAME )
def _RaiseExceptionForData(data): if data['exception']['TYPE'] == UnknownExtraConf.__name__: raise UnknownExtraConf(data['exception']['extra_conf_file']) raise ServerError('{0}: {1}'.format(data['exception']['TYPE'], data['message']))
def MakeServerException(data): if data['exception']['TYPE'] == UnknownExtraConf.__name__: return UnknownExtraConf(data['exception']['extra_conf_file']) return ServerError('{0}: {1}'.format(data['exception']['TYPE'], data['message']))
def MakeServerException(data): if data['exception']['TYPE'] == UnknownExtraConf.__name__: return UnknownExtraConf(data['exception']['extra_conf_file']) return ServerError(f'{ data[ "exception" ][ "TYPE" ] }: ' f'{ data[ "message" ] }')