コード例 #1
0
    def __store_args_or_set_to_defaults(self, args, defaults):

        LOGGER.debug('Setting the attributes:')

        # Useful for read and write:

        if args['handle_server_url']:
            self.__handle_server_url = args['handle_server_url']
            LOGGER.info(' - handle_server_url set to '+self.__handle_server_url)
        else:
            self.__handle_server_url = defaults['handle_server_url']
            LOGGER.info(' - handle_server_url set to default: '+self.__handle_server_url)


        if args['REST_API_url_extension']:
            self.__REST_API_url_extension = args['REST_API_url_extension']
            LOGGER.info(' - url_extension_REST_API set to: '+self.__REST_API_url_extension)
        else:
            self.__REST_API_url_extension = defaults['REST_API_url_extension']
            LOGGER.info(' - url_extension_REST_API set to default: '+self.__REST_API_url_extension)


        if args['HTTPS_verify'] is not None:
            self.__HTTPS_verify = utilconfig.get_valid_https_verify(
                args['HTTPS_verify']
            )
            LOGGER.info(' - https_verify set to: '+str(self.__HTTPS_verify))
        else:
            self.__HTTPS_verify = defaults['HTTPS_verify']
            LOGGER.info(' - https_verify set to default: '+str(self.__HTTPS_verify))


        # Useful for write:

        if args['password']:
            self.__password = args['password']
            LOGGER.info(' - password set.')

        if args['username']:
            self.__username = args['username']
            LOGGER.info(' - username set to: '+self.__username)

        if args['certificate_only']:
            self.__certificate_only = args['certificate_only']
            LOGGER.info(' - certificate_only set to: '+str(self.__certificate_only))

        if args['private_key']:
            self.__private_key = args['private_key']
            LOGGER.info(' - private_key set to: '+str(self.__private_key))

        if args['certificate_and_key']:
            self.__certificate_and_key = args['certificate_and_key']
            LOGGER.info(' - certificate_and_key set to: '+str(self.__certificate_and_key))
コード例 #2
0
ファイル: searcher.py プロジェクト: cookie33/B2HANDLE
    def __store_args_or_set_to_defaults(self, args, defaults):

        LOGGER.debug('Setting the attributes:')

        if args['HTTPS_verify'] is not None: # Without this check, a passed "False" is not found!
            self.__HTTPS_verify = utilconfig.get_valid_https_verify(
                args['HTTPS_verify']
            )
            LOGGER.info(' - https_verify set to: '+str(self.__HTTPS_verify))
        else:
            self.__HTTPS_verify = defaults['HTTPS_verify']
            LOGGER.info(' - https_verify set to default: '+str(self.__HTTPS_verify))

        if args['allowed_search_keys'] is not None: # Without this check, empty lists are not found!
            self.__allowed_search_keys = args['allowed_search_keys']
            LOGGER.info(' - allowed_search_keys set to: '+str(self.__allowed_search_keys))
        else:
            self.__allowed_search_keys = defaults['allowed_search_keys']
            LOGGER.info(' - allowed_search_keys set to default: '+str(self.__allowed_search_keys))

        if args['reverselookup_baseuri']:
            self.__reverselookup_baseuri = args['reverselookup_baseuri']
            LOGGER.info(' - solrbaseurl set to: '+self.__reverselookup_baseuri)
        elif 'handle_server_url' in args.keys() and args['handle_server_url'] is not None:
            self.__reverselookup_baseuri = args['handle_server_url']
            LOGGER.info(' - solrbaseurl set to same as handle server: '+str(self.__reverselookup_baseuri))
        else:
            LOGGER.info(' - solrbaseurl: No default.')

        if args['reverselookup_url_extension']:
            self.__reverselookup_url_extension = args['reverselookup_url_extension']
            LOGGER.info(' - reverselookup_url_extension set to: '+self.__reverselookup_url_extension)
        else:
            self.__reverselookup_url_extension = defaults['reverselookup_url_extension']
            LOGGER.info(' - reverselookup_url_extension set to default: '+self.__reverselookup_url_extension)

        # Authentication reverse lookup:
        #   If specified, use it.
        #   Else: Try using handle system authentication
        #   Else: search_handle does not work and will raise an exception.

        if args['reverselookup_username']:
            self.__user = args['reverselookup_username']
            LOGGER.info('" - reverselookup_username set to: '+self.__user)
        elif args['username']:
            self.__user = args['username']
            self.__handle_system_username_used = True
            LOGGER.info(' - reverselookup_username set to handle server username: '******' - reverselookup_username: No default.')

        if args['reverselookup_password']:
            self.__password = args['reverselookup_password']
            LOGGER.info(' - reverselookup_password set.')
        elif args['password']:
            self.__password = args['password']
            self.__handle_system_password_used = True
            LOGGER.info(' - reverselookup_password set to handle server password.')
        else:
            LOGGER.info(' - reverselookup_password: No default.')

        if self.__user is not None and self.__password is not None:
            self.__has_search_access = True