certbot.display
¶
Certbot display utilities.
certbot.display.util
¶
Certbot display.
-
certbot.display.util.
DSELECT_HELP
= 'Use the arrow keys or Tab to move between window elements. Space can be used to complete the input path with the selected element in the directory window. Pressing enter will select the currently highlighted button.'¶ Help text on how to use dialog’s dselect.
-
certbot.display.util.
OK
= 'ok'¶ Display exit code indicating user acceptance.
-
certbot.display.util.
CANCEL
= 'cancel'¶ Display exit code for a user canceling the display.
-
certbot.display.util.
HELP
= 'help'¶ Display exit code when for when the user requests more help.
-
certbot.display.util.
_wrap_lines
(msg)[source]¶ Format lines nicely to 80 chars.
Parameters: msg (str) – Original message Returns: Formatted message respecting newlines in message Return type: str
-
class
certbot.display.util.
NcursesDisplay
(width=72, height=20)[source]¶ Bases:
object
Ncurses-based display.
-
notification
(message, height=10, pause=False)[source]¶ Display a notification to the user and wait for user acceptance.
Todo
It probably makes sense to use one of the transient message types for pause. It isn’t straightforward how best to approach the matter though given the context of our messages. http://pythondialog.sourceforge.net/doc/widgets.html#displaying-transient-messages
Parameters:
Display a menu.
Parameters: Returns: tuple of the form (
code
,index
) wherecode
- int display exit codeint
- index of the selected itemReturn type:
-
input
(message, **unused_kwargs)[source]¶ Display an input box to the user.
Parameters: Returns: tuple of the form (
code
,string
) wherecode
- int display exit codestring
- input entered by the user
-
yesno
(message, yes_label='Yes', no_label='No', **unused_kwargs)[source]¶ Display a Yes/No dialog box.
Yes and No label must begin with different letters.
Parameters: Returns: if yes_label was selected
Return type:
-
-
class
certbot.display.util.
FileDisplay
(outfile)[source]¶ Bases:
object
File-based display.
-
notification
(message, height=10, pause=True)[source]¶ Displays a notification and waits for user acceptance.
Parameters:
Display a menu.
Todo
This doesn’t enable the help label/button (I wasn’t sold on any interface I came up with for this). It would be a nice feature
Parameters: Returns: tuple of (
code
,index
) wherecode
- str display exit codeindex
- int index of the user’s selectionReturn type:
-
input
(message, **unused_kwargs)[source]¶ Accept input from the user.
Parameters: Returns: tuple of (
code
,input
) wherecode
- str display exit codeinput
- str of the user’s inputReturn type:
-
yesno
(message, yes_label='Yes', no_label='No', **unused_kwargs)[source]¶ Query the user with a yes/no question.
Yes and No label must begin with different letters, and must contain at least one letter each.
Parameters: Returns: True for “Yes”, False for “No”
Return type:
-
checklist
(message, tags, default_status=True, **unused_kwargs)[source]¶ Display a checklist.
Parameters: Returns: tuple of (
code
,tags
) wherecode
- str display exit codetags
- list of selected tagsReturn type:
-
directory_select
(message, **unused_kwargs)[source]¶ Display a directory selection screen.
Parameters: message (str) – prompt to give the user Returns: tuple of the form ( code
,string
) wherecode
- int display exit codestring
- input entered by the user
-
_scrub_checklist_input
(indices, tags)[source]¶ Validate input and transform indices to appropriate tags.
Parameters: Returns: valid tags the user selected
Return type:
Print a menu on the screen.
Parameters: - message (str) – title of menu
- choices (list of tuples (tag, item) or list of descriptions (tags will be enumerated)) – Menu lines
-
-
class
certbot.display.util.
NoninteractiveDisplay
(outfile)[source]¶ Bases:
object
An iDisplay implementation that never asks for interactive user input
-
_interaction_fail
(message, cli_flag, extra='')[source]¶ Error out in case of an attempt to interact in noninteractive mode
-
notification
(message, height=10, pause=False)[source]¶ Displays a notification without waiting for user acceptance.
Parameters:
Avoid displaying a menu.
Parameters: Returns: tuple of (
code
,index
) wherecode
- str display exit codeindex
- int index of the user’s selectionReturn type: Raises: errors.MissingCommandlineFlag – if there was no default
-
input
(message, default=None, cli_flag=None)[source]¶ Accept input from the user.
Parameters: message (str) – message to display to the user Returns: tuple of ( code
,input
) wherecode
- str display exit codeinput
- str of the user’s inputReturn type: tuple Raises: errors.MissingCommandlineFlag – if there was no default
-
yesno
(message, yes_label=None, no_label=None, default=None, cli_flag=None)[source]¶ Decide Yes or No, without asking anybody
Parameters: Raises: errors.MissingCommandlineFlag – if there was no default
Returns: True for “Yes”, False for “No”
Return type:
-
checklist
(message, tags, default=None, cli_flag=None, **kwargs)[source]¶ Display a checklist.
Parameters: Returns: tuple of (
code
,tags
) wherecode
- str display exit codetags
- list of selected tagsReturn type:
-
directory_select
(message, default=None, cli_flag=None)[source]¶ Simulate prompting the user for a directory.
This function returns default if it is not
None
, otherwise, an exception is raised explaining the problem. If cli_flag is notNone
, the error message will include the flag that can be used to set this value with the CLI.Parameters: Returns: tuple of the form (
code
,string
) wherecode
- int display exit codestring
- input entered by the user
-
certbot.display.ops
¶
Contains UI methods for LE user operations.
-
certbot.display.ops.
get_email
(more=False, invalid=False)[source]¶ Prompt for valid email address.
Parameters: Returns: Email or
None
if cancelled by user.Return type:
-
certbot.display.ops.
choose_account
(accounts)[source]¶ Choose an account.
Parameters: accounts (list) – Containing at least one Account
-
certbot.display.ops.
choose_names
(installer)[source]¶ Display screen to select domains to validate.
Parameters: installer ( certbot.interfaces.IInstaller
) – An installer objectReturns: List of selected names Return type: list
ofstr
-
certbot.display.ops.
get_valid_domains
(domains)[source]¶ - Helper method for choose_names that implements basic checks
- on domain names
Parameters: domains (list) – Domain names to validate Returns: List of valid domains Return type: list
-
certbot.display.ops.
_filter_names
(names)[source]¶ Determine which names the user would like to select from a list.
Parameters: names (list) – domain names Returns: tuple of the form ( code
,names
) wherecode
- str display exit codenames
- list of names selectedReturn type: tuple
-
certbot.display.ops.
_choose_names_manually
()[source]¶ Manually input names for those without an installer.
-
certbot.display.ops.
success_installation
(domains)[source]¶ Display a box confirming the installation of HTTPS.
Todo
This should be centered on the screen
Parameters: domains (list) – domain names which were enabled
-
certbot.display.ops.
success_renewal
(domains, action)[source]¶ Display a box confirming the renewal of an existing certificate.
Todo
This should be centered on the screen
Parameters:
certbot.display.enhancements
¶
Certbot Enhancement Display
-
certbot.display.enhancements.
ask
(enhancement)[source]¶ Display the enhancement to the user.
Parameters: enhancement (str) – One of the certbot.CONFIG.ENHANCEMENTS
enhancementsReturns: True if feature is desired, False otherwise Return type: bool Raises: .errors.Error – if the enhancement provided is not supported