def f(v): try: d = aniso8601.parse_datetime(v) d = d.replace(microsecond=0) if d.tzinfo: d = d.astimezone(tz.tzutc()) return d except: raise good.Invalid('invalid iso 8601 datetime {}'.format(v))
def f(v): try: utils.validate_cmd(v) return v except Exception as e: raise good.Invalid(str(e))
def f(v): if v not in constants.SHOW_EPISODE_TYPE: raise good.Invalid('invalid episodes type: {}'.format(v)) return v
def validate_email(email): """Validate email.""" if not "@" in email: raise good.Invalid("this is an invalid email address") return email
def f(v): if v not in constants.IMAGE_TYPES: raise good.Invalid('invalid image type: {}'.format(v)) return v
def f(v): try: return aniso8601.parse_time(v) except: raise good.Invalid('invalid time {}'.format(v))