本文整理汇总了Python中ubiquity.filteredcommand.FilteredCommand.error方法的典型用法代码示例。如果您正苦于以下问题:Python FilteredCommand.error方法的具体用法?Python FilteredCommand.error怎么用?Python FilteredCommand.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubiquity.filteredcommand.FilteredCommand
的用法示例。
在下文中一共展示了FilteredCommand.error方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: error
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
def error(self, priority, question):
if question == 'partman-partitioning/impossible_resize':
# Back up silently.
return False
elif question == 'partman-partitioning/bad_new_partition_size':
if self.creating_partition:
# Break out of creating the partition.
self.creating_partition['bad_size'] = True
elif question in ('partman-partitioning/bad_new_size',
'partman-partitioning/big_new_size',
'partman-partitioning/small_new_size',
'partman-partitioning/new_size_commit_failed'):
if self.editing_partition:
# Break out of resizing the partition.
self.editing_partition['bad_size'] = True
else:
# Break out of resizing the partition in cases where partman
# fed us bad boundary values. These are bugs in partman, but
# we should handle the result as gracefully as possible.
self.bad_auto_size = True
elif question == 'partman-basicfilesystems/bad_mountpoint':
# Break out of creating or editing the partition.
if self.creating_partition:
self.creating_partition['bad_mountpoint'] = True
elif self.editing_partition:
self.editing_partition['bad_mountpoint'] = True
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
示例2: error
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
def error(self, priority, question):
if question.startswith('passwd/username-'):
self.frontend.username_error(self.extended_description(question))
elif question.startswith('user-setup/password-'):
self.frontend.password_error(self.extended_description(question))
else:
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
示例3: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
def run(self, priority, question):
if self.done:
return self.succeeded
if question.startswith('partman/confirm'):
if question == 'partman/confirm':
self.db.set('ubiquity/partman-made-changes', 'true')
else:
self.db.set('ubiquity/partman-made-changes', 'false')
self.preseed(question, 'true')
return True
elif question == 'partman/exception_handler':
if priority == 'critical' or priority == 'high':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
self.choices(question), use_templates=False)
self.preseed(question, response, seen=False)
else:
self.preseed(question, 'unhandled', seen=False)
return True
elif question == 'partman/exception_handler_note':
if priority == 'critical' or priority == 'high':
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
else:
return True
elif self.question_type(question) == 'boolean':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/go_back', 'ubiquity/text/continue'))
answer_reversed = False
if (question == 'partman-jfs/jfs_boot' or
question == 'partman-jfs/jfs_root'):
answer_reversed = True
if response is None or response == 'ubiquity/text/continue':
answer = answer_reversed
else:
answer = not answer_reversed
self.succeeded = False
self.done = True
self.frontend.return_to_partitioning()
if answer:
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
return True
else:
return FilteredCommand.run(self, priority, question)
示例4: error
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
def error(self, priority, question):
if question == "hw-detect/modprobe_error":
# don't need to display this, and it's non-fatal
return True
elif question == "apt-setup/security-updates-failed":
fatal = False
else:
fatal = True
self.frontend.error_dialog(self.description(question), self.extended_description(question), fatal)
if fatal:
return FilteredCommand.error(self, priority, question)
else:
return True
示例5: error
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
def error(self, priority, question):
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
示例6: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
#.........这里部分代码省略.........
raise AssertionError, "Arrived at %s unexpectedly" % question
elif question in ('partman-basicfilesystems/mountpoint',
'partman-basicfilesystems/fat_mountpoint'):
if self.building_cache:
state = self.__state[-1]
assert state[0] == 'partman/active_partition'
partition = self.partition_cache[state[1]]
partition['mountpoint_choices'] = []
choices_c = self.choices_untranslated(question)
choices = self.choices(question)
assert len(choices_c) == len(choices)
for i in range(len(choices_c)):
if choices_c[i].startswith('/'):
partition['mountpoint_choices'].append((
choices_c[i].split(' ')[0],
choices_c[i], choices[i]))
# Back up to the previous menu.
return False
elif self.creating_partition or self.editing_partition:
if self.creating_partition:
request = self.creating_partition
else:
request = self.editing_partition
if 'bad_mountpoint' in request:
return False
mountpoint = request['mountpoint']
if mountpoint == '' or mountpoint is None:
self.preseed(question, 'Do not mount it')
else:
self.preseed(question, 'Enter manually')
return True
else:
raise AssertionError, "Arrived at %s unexpectedly" % question
elif question == 'partman-basicfilesystems/mountpoint_manual':
if self.creating_partition or self.editing_partition:
if self.creating_partition:
request = self.creating_partition
else:
request = self.editing_partition
if 'bad_mountpoint' in request:
return False
self.preseed(question, request['mountpoint'])
return True
else:
raise AssertionError, "Arrived at %s unexpectedly" % question
elif question.startswith('partman/confirm'):
if question == 'partman/confirm':
self.db.set('ubiquity/partman-made-changes', 'true')
else:
self.db.set('ubiquity/partman-made-changes', 'false')
self.preseed(question, 'true')
self.succeeded = True
self.done = True
return True
elif question == 'partman/exception_handler':
if priority == 'critical' or priority == 'high':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
self.choices(question), use_templates=False)
self.preseed(question, response)
else:
self.preseed(question, 'unhandled')
return True
elif question == 'partman/exception_handler_note':
if priority == 'critical' or priority == 'high':
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
else:
return True
elif self.question_type(question) == 'boolean':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/go_back', 'ubiquity/text/continue'))
answer_reversed = False
if question in ('partman-jfs/jfs_boot', 'partman-jfs/jfs_root',
'grub-installer/install_to_xfs'):
answer_reversed = True
if response is None or response == 'ubiquity/text/continue':
answer = answer_reversed
else:
answer = not answer_reversed
if answer:
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
return True
return FilteredCommand.run(self, priority, question)
示例7: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import error [as 别名]
#.........这里部分代码省略.........
partition = self.partition_cache[state[1]]
partition["mountpoint_choices"] = []
choices_c = self.choices_untranslated(question)
choices = self.choices(question)
assert len(choices_c) == len(choices)
for i in range(len(choices_c)):
if choices_c[i].startswith("/"):
partition["mountpoint_choices"].append((choices_c[i].split(" ")[0], choices_c[i], choices[i]))
# Back up to the previous menu.
return False
elif self.creating_partition or self.editing_partition:
if self.creating_partition:
request = self.creating_partition
else:
request = self.editing_partition
if "bad_mountpoint" in request:
return False
mountpoint = request["mountpoint"]
if mountpoint == "" or mountpoint is None:
self.preseed(question, "Do not mount it", seen=False)
else:
self.preseed(question, "Enter manually", seen=False)
return True
else:
raise AssertionError, "Arrived at %s unexpectedly" % question
elif question == "partman-basicfilesystems/mountpoint_manual":
if self.creating_partition or self.editing_partition:
if self.creating_partition:
request = self.creating_partition
else:
request = self.editing_partition
if "bad_mountpoint" in request:
return False
self.preseed(question, request["mountpoint"], seen=False)
return True
else:
raise AssertionError, "Arrived at %s unexpectedly" % question
elif question.startswith("partman/confirm"):
if question == "partman/confirm":
self.db.set("ubiquity/partman-made-changes", "true")
else:
self.db.set("ubiquity/partman-made-changes", "false")
self.preseed(question, "true", seen=False)
self.succeeded = True
self.done = True
return True
elif question == "partman/exception_handler":
if priority == "critical" or priority == "high":
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
self.choices(question),
use_templates=False,
)
self.preseed(question, response, seen=False)
else:
self.preseed(question, "unhandled", seen=False)
return True
elif question == "partman/exception_handler_note":
if priority == "critical" or priority == "high":
self.frontend.error_dialog(self.description(question), self.extended_description(question))
return FilteredCommand.error(self, priority, question)
else:
return True
elif question == "partman/installation_medium_mounted":
self.frontend.installation_medium_mounted(self.extended_description(question))
return True
elif self.question_type(question) == "boolean":
if question == "partman/unmount_active":
yes = "ubiquity/imported/yes"
no = "ubiquity/imported/no"
else:
yes = "ubiquity/text/continue"
no = "ubiquity/text/go_back"
response = self.frontend.question_dialog(
self.description(question), self.extended_description(question), (no, yes)
)
answer_reversed = False
if question in ("partman-jfs/jfs_boot", "partman-jfs/jfs_root", "partman/unmount_active"):
answer_reversed = True
if response is None or response == yes:
answer = answer_reversed
else:
answer = not answer_reversed
if answer:
self.preseed(question, "true", seen=False)
else:
self.preseed(question, "false", seen=False)
return True
return FilteredCommand.run(self, priority, question)