本文整理汇总了Python中karesansui.lib.checker.Checker.check_status方法的典型用法代码示例。如果您正苦于以下问题:Python Checker.check_status方法的具体用法?Python Checker.check_status怎么用?Python Checker.check_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karesansui.lib.checker.Checker
的用法示例。
在下文中一共展示了Checker.check_status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validates_uriguest_status
# 需要导入模块: from karesansui.lib.checker import Checker [as 别名]
# 或者: from karesansui.lib.checker.Checker import check_status [as 别名]
def validates_uriguest_status(obj):
checker = Checker()
check = True
_ = obj._
checker.errors = []
if is_param(obj.input, "status"):
check = (
checker.check_status(
_("Status"),
obj.input.status,
CHECK_EMPTY | CHECK_VALID,
[
GUEST_ACTION_CREATE,
GUEST_ACTION_SHUTDOWN,
GUEST_ACTION_DESTROY,
GUEST_ACTION_SUSPEND,
GUEST_ACTION_RESUME,
GUEST_ACTION_REBOOT,
GUEST_ACTION_ENABLE_AUTOSTART,
GUEST_ACTION_DISABLE_AUTOSTART,
],
)
and check
)
else:
check = False
checker.add_error(_('"%s" is required.') % _("Status"))
obj.view.alert = checker.errors
return check
示例2: validates_jobsearch
# 需要导入模块: from karesansui.lib.checker import Checker [as 别名]
# 或者: from karesansui.lib.checker.Checker import check_status [as 别名]
def validates_jobsearch(obj):
checker = Checker()
_ = obj._
checker.errors = []
check = True
edit = False
if is_param(obj.input, "name", True) is True:
edit = True
check = checker.check_string(
_('Machine Name'),
obj.input.name,
CHECK_LENGTH | CHECK_ONLYSPACE | CHECK_VALID,
'[%_]',
min = MACHINE_NAME_MIN_LENGTH,
max = MACHINE_NAME_MAX_LENGTH,
) and check
if is_param(obj.input, "user", True) is True:
edit = True
check = checker.check_string(
_('Create User'),
obj.input.user,
CHECK_LENGTH | CHECK_ONLYSPACE | CHECK_VALID,
'[%_]',
min = USER_MIN_LENGTH,
max = USER_MAX_LENGTH,
) and check
if is_param(obj.input, "status", True) is True:
edit = True
check = checker.check_status(
_('Status'),
obj.input.status,
CHECK_VALID,
JOBGROUP_STATUS.values()
) and check
if is_param(obj.input, "start", True) is True:
edit = True
check = checker.check_datetime_string(
_('Created'),
obj.input.start,
CHECK_VALID,
obj.me.languages
) and check
if is_param(obj.input, "end", True) is True:
edit = True
check = checker.check_datetime_string(
_('Created'),
obj.input.end,
CHECK_VALID,
obj.me.languages
) and check
obj.view.alert = checker.errors
return check, edit
示例3: validates_nw_status
# 需要导入模块: from karesansui.lib.checker import Checker [as 别名]
# 或者: from karesansui.lib.checker.Checker import check_status [as 别名]
def validates_nw_status(obj):
checker = Checker()
check = True
_ = obj._
checker.errors = []
if is_param(obj.input, "status"):
status = int(obj.input.status)
check = (
checker.check_status(_("Status"), status, CHECK_EMPTY | CHECK_VALID, [NETWORK_ACTIVE, NETWORK_INACTIVE])
and check
)
else:
check = False
checker.add_error(_('"%s" is required.') % _("Status"))
obj.view.alert = checker.errors
return check
示例4: validates_iptables_status
# 需要导入模块: from karesansui.lib.checker import Checker [as 别名]
# 或者: from karesansui.lib.checker.Checker import check_status [as 别名]
def validates_iptables_status(obj):
checker = Checker()
check = True
_ = obj._
checker.errors = []
if is_param(obj.input, 'status'):
check = checker.check_status(
_('Status'),
obj.input.status,
CHECK_EMPTY | CHECK_VALID,
IPTABLES_STATUS.values()
) and check
else:
check = False
checker.add_error(_('"%s" is required.') % _('Status'))
obj.view.alert = checker.errors
return check