Пример #1
0
    def _validate_proxy(self, proxy):
        if not proxy:
            return

        try:
            ProxyString(url=proxy)
        except ProxyStringError as e:
            raise InvalidValueError(
                "Proxy URL does not have valid format: {}".format(str(e)))
Пример #2
0
    def set_languages(self, languages):
        """Languages marked for installation.

        Possible values are list of languages split by ',' or 'none' or 'all'.

        'none' - Use nil in the rpm macro.
        'all'  - Default behavior.

        :param languages: list of languages split by ',' or 'none' or 'all'
        :type languages: str
        """
        # raise exception if languages is None or ""
        if not languages:
            raise InvalidValueError("Languages value have to be 'none', "
                                    "'all' or list of languages")
        self._languages = languages
        self.languages_changed.emit()
        log.debug("Install languages is set to %s.", languages)
Пример #3
0
 def _validate_subscription_request_type(self, request_type):
     """Check that subscription request is of known type."""
     if request_type not in SUBSCRIPTION_REQUEST_VALID_TYPES:
         raise InvalidValueError(
             "Invalid subscription request type set '{}'".format(
                 request_type))
Пример #4
0
 def _validate_url(self, url_type):
     try:
         URLType(url_type)
     except ValueError:
         raise InvalidValueError(
             "Invalid source type set '{}'".format(url_type))
Пример #5
0
 def _validate_url(self, url_type):
     if url_type not in URL_TYPES:
         raise InvalidValueError(
             "Invalid source type set '{}'".format(url_type))