mirror of
https://github.com/certbot/certbot.git
synced 2026-06-11 01:30:14 -04:00
fix exception when using FileDisplay (-t), class was missing the redirect_by_default method
moved common stuff to CommonDisplayMixin class.
This commit is contained in:
parent
16e9d887ab
commit
8d32a9a4d8
1 changed files with 21 additions and 17 deletions
|
|
@ -10,7 +10,26 @@ WIDTH = 72
|
|||
HEIGHT = 20
|
||||
|
||||
|
||||
class NcursesDisplay(object):
|
||||
class CommonDisplayMixin(object):
|
||||
"""methods common to both NcursesDisplay and FileDisplay"""
|
||||
|
||||
def redirect_by_default(self):
|
||||
choices = [
|
||||
("Easy", "Allow both HTTP and HTTPS access to these sites"),
|
||||
("Secure", "Make all requests redirect to secure HTTPS access")]
|
||||
|
||||
result = self.generic_menu(
|
||||
"Please choose whether HTTPS access is required or optional.",
|
||||
choices, "Please enter the appropriate number")
|
||||
|
||||
if result[0] != OK:
|
||||
return False
|
||||
|
||||
# different answer for each type of display
|
||||
return str(result[1]) == "Secure" or result[1] == 1
|
||||
|
||||
|
||||
class NcursesDisplay(CommonDisplayMixin):
|
||||
zope.interface.implements(interfaces.IDisplay)
|
||||
|
||||
def __init__(self, width=WIDTH, height=HEIGHT):
|
||||
|
|
@ -85,23 +104,8 @@ class NcursesDisplay(object):
|
|||
print text
|
||||
self.dialog.msgbox(text, width=self.width, height=self.height)
|
||||
|
||||
def redirect_by_default(self):
|
||||
choices = [
|
||||
("Easy", "Allow both HTTP and HTTPS access to these sites"),
|
||||
("Secure", "Make all requests redirect to secure HTTPS access")]
|
||||
|
||||
result = self.generic_menu(
|
||||
"Please choose whether HTTPS access is required or optional.",
|
||||
choices, "Please enter the appropriate number")
|
||||
|
||||
if result[0] != OK:
|
||||
return False
|
||||
|
||||
# different answer for each type of display
|
||||
return str(result[1]) == "Secure" or result[1] == 1
|
||||
|
||||
|
||||
class FileDisplay(object):
|
||||
class FileDisplay(CommonDisplayMixin):
|
||||
zope.interface.implements(interfaces.IDisplay)
|
||||
|
||||
def __init__(self, outfile):
|
||||
|
|
|
|||
Loading…
Reference in a new issue