WIP: validators #3
1 changed files with 10 additions and 0 deletions
|
@ -11,6 +11,8 @@ def empty(field: str) -> bool:
|
|||
|
||||
|
||||
def iso_date(field: str) -> bool:
|
||||
if not field:
|
||||
return False
|
||||
try:
|
||||
datetime.datetime.strptime(field, "%Y-%m-%d")
|
||||
return True
|
||||
|
@ -19,6 +21,10 @@ def iso_date(field: str) -> bool:
|
|||
|
||||
|
||||
def valid_iban(field: str) -> bool:
|
||||
if not field:
|
||||
return False
|
||||
if not type(field) == str:
|
||||
return False
|
||||
try:
|
||||
IBAN(field)
|
||||
return True
|
||||
|
@ -27,6 +33,10 @@ def valid_iban(field: str) -> bool:
|
|||
|
||||
|
||||
def valid_bic(field: str) -> bool:
|
||||
if not field:
|
||||
return False
|
||||
if not type(field) == str:
|
||||
return False
|
||||
try:
|
||||
BIC(field)
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue