mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:41:53 +02:00
Merge pull request #176 from ThomasWaldmann/textmode-fix
fix exception when using FileDisplay (-t), was missing the redirect_by_default method
This commit is contained in:
@@ -10,7 +10,26 @@ WIDTH = 72
|
|||||||
HEIGHT = 20
|
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)
|
zope.interface.implements(interfaces.IDisplay)
|
||||||
|
|
||||||
def __init__(self, width=WIDTH, height=HEIGHT):
|
def __init__(self, width=WIDTH, height=HEIGHT):
|
||||||
@@ -85,23 +104,8 @@ class NcursesDisplay(object):
|
|||||||
print text
|
print text
|
||||||
self.dialog.msgbox(text, width=self.width, height=self.height)
|
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(
|
class FileDisplay(CommonDisplayMixin):
|
||||||
"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):
|
|
||||||
zope.interface.implements(interfaces.IDisplay)
|
zope.interface.implements(interfaces.IDisplay)
|
||||||
|
|
||||||
def __init__(self, outfile):
|
def __init__(self, outfile):
|
||||||
|
|||||||
Reference in New Issue
Block a user