Exemplo n.º 1
0
def validated(duration, unit):

    if (str(unit).upper() in ['H', 'M', 'D']) and \
      ((str(unit).upper() == 'D' and (0 < duration <= 365)) or \
       (str(unit).upper() == 'H' and (0 < duration <= 23)) or \
       (str(unit).upper() == 'M' and (0 < duration <= 59))):
        return True
    else:
        logger.error('Invalid --duration/--unit value.')
        return False