Coverage for certbot/display/ops.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Contains UI methods for LE user operations."""
# Define a helper function to avoid verbose code
"""Prompt for valid email address.
:param bool invalid: True if an invalid address was provided by the user :param bool optional: True if the user can use --register-unsafely-without-email to avoid providing an e-mail
:returns: e-mail address :rtype: str
:raises errors.Error: if the user cancels
""" "the client with --register-unsafely-without-email " "but make sure you then backup your account key from " "{0}\n\n".format(os.path.join( compat.get_default_folder('config'), 'accounts'))) else: else:
invalid_prefix + msg if invalid else msg, force_interactive=True) "or provide --agree-tos and --email <email_address> flags.")
"An e-mail address or " "--register-unsafely-without-email must be provided.") else:
"""Choose an account.
:param list accounts: Containing at least one :class:`~certbot.account.Account`
""" # Note this will get more complicated once we start recording authorizations
"Please choose an account", labels, force_interactive=True) else:
"""Display screen to let user pick one or multiple values from the provided list.
:param list values: Values to select from
:returns: List of selected values :rtype: list """ question, tags=values, force_interactive=True) else:
"""Display screen to select domains to validate.
:param installer: An installer object :type installer: :class:`certbot.interfaces.IInstaller`
:param `str` question: Overriding dialog question to ask the user if asked to choose from domain names.
:returns: List of selected names :rtype: `list` of `str`
"""
"No names were found in your configuration files. ")
else:
"""Helper method for choose_names that implements basic checks on domain names
:param list domains: Domain names to validate :return: List of valid domains :rtype: list """
"""Sort FQDNs by SLD (and if many, by their subdomains)
:param list FQDNs: list of domain names
:returns: Sorted list of domain names :rtype: list """
"""Determine which names the user would like to select from a list.
:param list names: domain names
:returns: tuple of the form (`code`, `names`) where `code` - str display exit code `names` - list of names selected :rtype: tuple
""" #Sort by domain first, and then by subdomain else: question, tags=sorted_names, cli_flag="--domains", force_interactive=True)
"""Manually input names for those without an installer.
:param str prompt_prefix: string to prepend to prompt for domains
:returns: list of provided names :rtype: `list` of `str`
""" prompt_prefix + "Please enter in your domain name(s) (comma and/or space separated) ", cli_flag="--domains", force_interactive=True)
"Internationalized domain names are not presently " "supported.{0}{0}Would you like to re-enter the " "names?{0}").format(os.linesep)
"One or more of the entered domain names was not valid:" "{0}{0}").format(os.linesep) os.linesep, domain, invalid_domains[domain]) "{0}Would you like to re-enter the names?{0}").format( os.linesep)
# We had error in input force_interactive=True) else:
"""Display a box confirming the installation of HTTPS.
:param list domains: domain names which were enabled
""" "Congratulations! You have successfully enabled {0}{1}{1}" "You should test your configuration at:{1}{2}".format( _gen_https_names(domains), os.linesep, os.linesep.join(_gen_ssl_lab_urls(domains))), pause=False)
"""Display a box confirming the renewal of an existing certificate.
:param list domains: domain names which were renewed
""" "Your existing certificate has been successfully renewed, and the " "new certificate has been installed.{1}{1}" "The new certificate covers the following domains: {0}{1}{1}" "You should test your configuration at:{1}{2}".format( _gen_https_names(domains), os.linesep, os.linesep.join(_gen_ssl_lab_urls(domains))), pause=False)
"""Display a box confirming a certificate has been revoked.
:param list cert_path: path to certificate which was revoked.
""" "Congratulations! You have successfully revoked the certificate " "that was located at {0}{1}{1}".format( cert_path, os.linesep), pause=False)
"""Returns a list of urls.
:param list domains: Each domain is a 'str'
"""
"""Returns a string of the https domains.
Domains are formatted nicely with https:// prepended to each.
:param list domains: Each domain is a 'str'
""" ", ".join("https://%s" % dom for dom in domains[:-1]), ", and https://", domains[-1])
default, message, exc_info=True)
raw, message, exc_info=True) else:
"""Like `~certbot.interfaces.IDisplay.input`, but with validation.
:param callable validator: A method which will be called on the supplied input. If the method raises a `errors.Error`, its text will be displayed and the user will be re-prompted. :param list `*args`: Arguments to be passed to `~certbot.interfaces.IDisplay.input`. :param dict `**kwargs`: Arguments to be passed to `~certbot.interfaces.IDisplay.input`. :return: as `~certbot.interfaces.IDisplay.input` :rtype: tuple """ validator, *args, **kwargs)
"""Like `~certbot.interfaces.IDisplay.directory_select`, but with validation.
:param callable validator: A method which will be called on the supplied input. If the method raises a `errors.Error`, its text will be displayed and the user will be re-prompted. :param list `*args`: Arguments to be passed to `~certbot.interfaces.IDisplay.directory_select`. :param dict `**kwargs`: Arguments to be passed to `~certbot.interfaces.IDisplay.directory_select`. :return: as `~certbot.interfaces.IDisplay.directory_select` :rtype: tuple """ validator, *args, **kwargs) |