Example #1
0
 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))
Example #2
0
 def f(v):
     try:
         utils.validate_cmd(v)
         return v
     except Exception as e:
         raise good.Invalid(str(e))
Example #3
0
 def f(v):
     if v not in constants.SHOW_EPISODE_TYPE:
         raise good.Invalid('invalid episodes type: {}'.format(v))
     return v
Example #4
0
def validate_email(email):
    """Validate email."""
    if not "@" in email:
        raise good.Invalid("this is an invalid email address")
    return email
Example #5
0
 def f(v):
     if v not in constants.IMAGE_TYPES:
         raise good.Invalid('invalid image type: {}'.format(v))
     return v
Example #6
0
 def f(v):    
     try:
         return aniso8601.parse_time(v)
     except:
         raise good.Invalid('invalid time {}'.format(v))