コード例 #1
0
def validates_report(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'report_start_day'):
        check = checker.check_datetime_string(_('Start Date'),
                                              obj.input.report_start_day,
                                              CHECK_EMPTY | CHECK_VALID,
                                              obj.me.languages,
                                              ) and check

    if is_param(obj.input, 'report_end_day'):
        check = checker.check_datetime_string(_('End Date'),
                                              obj.input.report_end_day,
                                              CHECK_EMPTY | CHECK_VALID,
                                              obj.me.languages,
                                              ) and check

    if is_param(obj.input, 'report_start_time'):
        check = checker.check_time_string(_('Start Time'),
                                          obj.input.report_start_time,
                                          CHECK_EMPTY | CHECK_VALID,
                                          ) and check

    if is_param(obj.input, 'report_end_time'):
        check = checker.check_time_string(_('End Time'),
                                          obj.input.report_end_time,
                                          CHECK_EMPTY | CHECK_VALID,
                                          ) and check

    obj.view.alert = checker.errors
    return check
コード例 #2
0
ファイル: hostby1logby1.py プロジェクト: goura/karesansui
def validates_log(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 's'):
        check = checker.check_datetime_string(_('Start Date'),
                                              obj.input.s,
                                              CHECK_EMPTY | CHECK_VALID,
                                              obj.me.languages,
                                              ) and check

    if is_param(obj.input, 'e'):
        check = checker.check_datetime_string(_('End Date'),
                                              obj.input.e,
                                              CHECK_EMPTY | CHECK_VALID,
                                              obj.me.languages,
                                              ) and check

    if is_param(obj.input, 'st'):
        check = checker.check_time_string(_('Start Time'),
                                          obj.input.st,
                                          CHECK_EMPTY | CHECK_VALID,
                                          ) and check

    if is_param(obj.input, 'et'):
        check = checker.check_time_string(_('End Time'),
                                          obj.input.et,
                                          CHECK_EMPTY | CHECK_VALID,
                                          ) and check

    obj.view.alert = checker.errors
    return check
コード例 #3
0
def validates_log(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, "s"):
        check = (
            checker.check_datetime_string(_("Start Date"), obj.input.s, CHECK_EMPTY | CHECK_VALID, obj.me.languages)
            and check
        )

    if is_param(obj.input, "e"):
        check = (
            checker.check_datetime_string(_("End Date"), obj.input.e, CHECK_EMPTY | CHECK_VALID, obj.me.languages)
            and check
        )

    if is_param(obj.input, "st"):
        check = checker.check_time_string(_("Start Time"), obj.input.st, CHECK_EMPTY | CHECK_VALID) and check

    if is_param(obj.input, "et"):
        check = checker.check_time_string(_("End Time"), obj.input.et, CHECK_EMPTY | CHECK_VALID) and check

    obj.view.alert = checker.errors
    return check
コード例 #4
0
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
コード例 #5
0
def validates_log(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 's'):
        check = checker.check_datetime_string(
            _('Start Date'),
            obj.input.s,
            CHECK_EMPTY | CHECK_VALID,
            obj.me.languages,
        ) and check

    if is_param(obj.input, 'e'):
        check = checker.check_datetime_string(
            _('End Date'),
            obj.input.e,
            CHECK_EMPTY | CHECK_VALID,
            obj.me.languages,
        ) and check

    if is_param(obj.input, 'st'):
        check = checker.check_time_string(
            _('Start Time'),
            obj.input.st,
            CHECK_EMPTY | CHECK_VALID,
        ) and check

    if is_param(obj.input, 'et'):
        check = checker.check_time_string(
            _('End Time'),
            obj.input.et,
            CHECK_EMPTY | CHECK_VALID,
        ) and check

    obj.view.alert = checker.errors
    return check
コード例 #6
0
def validates_report(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'report_start_day'):
        check = checker.check_datetime_string(
            _('Start Date'),
            obj.input.report_start_day,
            CHECK_EMPTY | CHECK_VALID,
            obj.me.languages,
        ) and check

    if is_param(obj.input, 'report_end_day'):
        check = checker.check_datetime_string(
            _('End Date'),
            obj.input.report_end_day,
            CHECK_EMPTY | CHECK_VALID,
            obj.me.languages,
        ) and check

    if is_param(obj.input, 'report_start_time'):
        check = checker.check_time_string(
            _('Start Time'),
            obj.input.report_start_time,
            CHECK_EMPTY | CHECK_VALID,
        ) and check

    if is_param(obj.input, 'report_end_time'):
        check = checker.check_time_string(
            _('End Time'),
            obj.input.report_end_time,
            CHECK_EMPTY | CHECK_VALID,
        ) and check

    obj.view.alert = checker.errors
    return check